Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)"
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ fn settings() -> Result<Settings, Failure> {
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(
Expand Down
26 changes: 12 additions & 14 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
24 changes: 12 additions & 12 deletions src/toastfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
12 changes: 6 additions & 6 deletions toast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down