diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af203f8..267e9c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,8 +83,8 @@ jobs: # https://github.com/rust-lang/rustup/issues/2441 # # for more information. - rustup toolchain install 1.88.0 --no-self-update # [ref:rust_1.88.0] - rustup default 1.88.0 # [ref:rust_1.88.0] + rustup toolchain install 1.91.0 --no-self-update # [ref:rust_1.91.0] + rustup default 1.91.0 # [ref:rust_1.91.0] # Add the targets. rustup target add x86_64-pc-windows-msvc @@ -124,8 +124,8 @@ jobs: set -euxo pipefail # Install the appropriate version of Rust. - rustup toolchain install 1.88.0 # [ref:rust_1.88.0] - rustup default 1.88.0 # [ref:rust_1.88.0] + rustup toolchain install 1.91.0 # [ref:rust_1.91.0] + rustup default 1.91.0 # [ref:rust_1.91.0] # Add the targets. rustup target add x86_64-apple-darwin @@ -200,8 +200,8 @@ jobs: set -euxo pipefail # Install the appropriate version of Rust. - rustup toolchain install 1.88.0 # [ref:rust_1.88.0] - rustup default 1.88.0 # [ref:rust_1.88.0] + rustup toolchain install 1.91.0 # [ref:rust_1.91.0] + rustup default 1.91.0 # [ref:rust_1.91.0] # Fetch the program version. VERSION="$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" diff --git a/src/main.rs b/src/main.rs index d12c736..cc3d70c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -273,10 +273,10 @@ fn settings() -> Result { current_dir().map_err(failure::system("Unable to determine working directory."))?; loop { let candidate_path = candidate_dir.join(TOASTFILE_DEFAULT_NAME); - if let Ok(metadata) = fs::metadata(&candidate_path) { - if metadata.file_type().is_file() { - return Ok(candidate_path); - } + if let Ok(metadata) = fs::metadata(&candidate_path) + && metadata.file_type().is_file() + { + return Ok(candidate_path); } if !candidate_dir.pop() { return Err(Failure::User( diff --git a/src/runner.rs b/src/runner.rs index 79f076c..ed016d2 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -29,10 +29,10 @@ pub struct Context { impl Drop for Context { fn drop(&mut self) { // Delete the image if needed. - if !self.persist { - if let Err(e) = docker::delete_image(&self.docker_cli, &self.image, &self.interrupted) { - error!("{}", e); - } + if !self.persist + && let Err(e) = docker::delete_image(&self.docker_cli, &self.image, &self.interrupted) + { + error!("{}", e); } } } @@ -208,15 +208,14 @@ pub fn run( ) } else { // Pull the image if necessary. Force reading from the remote if configured. - if force_pull + if (force_pull || !match docker::image_exists(&settings.docker_cli, &context.image, interrupted) { Ok(exists) => exists, Err(e) => return (Err(e), Some(context)), - } + }) + && let Err(e) = docker::pull_image(&settings.docker_cli, &context.image, interrupted) { - if let Err(e) = docker::pull_image(&settings.docker_cli, &context.image, interrupted) { - return (Err(e), Some(context)); - } + return (Err(e), Some(context)); } // Create a container from the image. @@ -335,12 +334,11 @@ pub fn run( }; // Write to remote cache, if applicable. - if persist_remotely { - if let Err(e) = + if persist_remotely + && let Err(e) = docker::push_image(&settings.docker_cli, &new_context.image, interrupted) - { - return (Err(e), Some(new_context)); - } + { + return (Err(e), Some(new_context)); } // Return the new context. diff --git a/src/toastfile.rs b/src/toastfile.rs index a0e1b59..bd4b0e0 100644 --- a/src/toastfile.rs +++ b/src/toastfile.rs @@ -578,18 +578,18 @@ fn check_task(name: &str, task: &Task) -> Result<(), Failure> { } // Check that `location` is absolute [tag:task_location_absolute]. - if let Some(location) = &task.location { - if !location.is_absolute() { - return Err(Failure::User( - format!( - "Task {} has a relative {}: {}.", - name.code_str(), - "location".code_str(), - location.to_string_lossy().code_str(), - ), - None, - )); - } + if let Some(location) = &task.location + && !location.is_absolute() + { + return Err(Failure::User( + format!( + "Task {} has a relative {}: {}.", + name.code_str(), + "location".code_str(), + location.to_string_lossy().code_str(), + ), + None, + )); } // If a task has any mount paths, then caching should be disabled [tag:mount_paths_nand_cache]. diff --git a/toast.yml b/toast.yml index 320e9a1..813d60c 100644 --- a/toast.yml +++ b/toast.yml @@ -17,11 +17,11 @@ command_prefix: | cargo-offline () { cargo --frozen --offline "$@"; } # Use this wrapper for formatting code or checking that code is formatted. We use a nightly Rust - # version for the `trailing_comma` formatting option [tag:rust_fmt_nightly_2025-07-06]. The + # version for the `trailing_comma` formatting option [tag:rust_fmt_nightly_2025-11-02]. The # nightly version was chosen as the latest available release with all components present # according to this page: # https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu.html - cargo-fmt () { cargo +nightly-2025-07-06 --frozen --offline fmt --all -- "$@"; } + cargo-fmt () { cargo +nightly-2025-11-02 --frozen --offline fmt --all -- "$@"; } # Make Bash log commands. set -x @@ -92,18 +92,18 @@ tasks: - install_packages - create_user command: | - # Install stable Rust [tag:rust_1.88.0]. + # Install stable Rust [tag:rust_1.91.0]. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ -y \ - --default-toolchain 1.88.0 \ + --default-toolchain 1.91.0 \ --profile minimal \ --component clippy # Add Rust tools to `$PATH`. . "$HOME/.cargo/env" - # Install nightly Rust [ref:rust_fmt_nightly_2025-07-06]. - rustup toolchain install nightly-2025-07-06 --profile minimal --component rustfmt + # Install nightly Rust [ref:rust_fmt_nightly_2025-11-02]. + rustup toolchain install nightly-2025-11-02 --profile minimal --component rustfmt install_tools: description: Install the tools needed to build and validate the program.