Skip to content

Commit 97b50ef

Browse files
authored
Update to Rust 2024 edition (#456)
Updates the project to Rust 2024 edition: - https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html - https://doc.rust-lang.org/edition-guide/rust-2024/index.html Most changes were applied via `cargo clippy --all-targets --fix` and `cargo fmt`. GUS-W-19631971.
1 parent e35cef0 commit 97b50ef

18 files changed

+228
-203
lines changed

Cargo.lock

Lines changed: 152 additions & 144 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ cache_diff = { version = "1.1", features = ["bullet_stream"] }
99
magic_migrate = { version = "2" }
1010

1111
[workspace.package]
12-
edition = "2021"
13-
rust-version = "1.85"
12+
edition = "2024"
13+
rust-version = "1.89"
1414

1515
[workspace.lints.rust]
1616
unreachable_pub = "warn"

buildpacks/ruby/src/layers/bundle_download_layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use cache_diff::CacheDiff;
1111
use commons::gemfile_lock::ResolvedBundlerVersion;
1212
use commons::layer::diff_migrate::DiffMigrateLayer;
1313
use fun_run::{self, CommandWithName};
14+
use libcnb::Env;
1415
use libcnb::data::layer_name;
1516
use libcnb::layer::{EmptyLayerCause, LayerState};
1617
use libcnb::layer_env::{LayerEnv, ModificationBehavior, Scope};
17-
use libcnb::Env;
1818
use magic_migrate::TryMigrate;
1919
use serde::{Deserialize, Serialize};
2020
use std::path::Path;

buildpacks/ruby/src/layers/bundle_install_layer.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use indoc::formatdoc;
1919
use libcnb::data::layer_name;
2020
use libcnb::layer::{EmptyLayerCause, LayerState};
2121
use libcnb::{
22-
layer_env::{LayerEnv, ModificationBehavior, Scope},
2322
Env,
23+
layer_env::{LayerEnv, ModificationBehavior, Scope},
2424
};
2525
use magic_migrate::TryMigrate;
2626
use serde::{Deserialize, Serialize};
@@ -153,7 +153,7 @@ impl From<MetadataV3> for MetadataV4 {
153153
}
154154

155155
fn layer_env(layer_path: &Path, app_dir: &Path, without_default: &BundleWithout) -> LayerEnv {
156-
let layer_env = LayerEnv::new()
156+
LayerEnv::new()
157157
.chainable_insert(
158158
Scope::All,
159159
ModificationBehavior::Override,
@@ -184,8 +184,7 @@ fn layer_env(layer_path: &Path, app_dir: &Path, without_default: &BundleWithout)
184184
ModificationBehavior::Override,
185185
"BUNDLE_FROZEN", // Requires the `Gemfile.lock` to be in sync with the current `Gemfile`.
186186
"1",
187-
);
188-
layer_env
187+
)
189188
}
190189

191190
/// Displays the `bundle install` command with `BUNDLE_` environment variables

buildpacks/ruby/src/layers/ruby_install_layer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
//!
1414
use crate::target_id::OsDistribution;
1515
use crate::{
16-
target_id::{TargetId, TargetIdError},
1716
RubyBuildpack, RubyBuildpackError,
17+
target_id::{TargetId, TargetIdError},
1818
};
1919
use bullet_stream::global::print;
2020
use cache_diff::CacheDiff;
@@ -24,7 +24,7 @@ use flate2::read::GzDecoder;
2424
use libcnb::data::layer_name;
2525
use libcnb::layer::{EmptyLayerCause, LayerState};
2626
use libcnb::layer_env::LayerEnv;
27-
use libherokubuildpack::download::{download_file, DownloadError};
27+
use libherokubuildpack::download::{DownloadError, download_file};
2828
use magic_migrate::TryMigrate;
2929
use serde::{Deserialize, Serialize};
3030
use std::path::Path;

buildpacks/ruby/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use core::str::FromStr;
1010
use fs_err::PathExt;
1111
use fun_run::CmdError;
1212
use layers::ruby_install_layer::RubyInstallError;
13+
use libcnb::Platform;
1314
use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder};
1415
use libcnb::data::build_plan::{BuildPlanBuilder, Require};
1516
use libcnb::data::launch::LaunchBuilder;
@@ -18,8 +19,7 @@ use libcnb::detect::{DetectContext, DetectResult, DetectResultBuilder};
1819
use libcnb::generic::{GenericMetadata, GenericPlatform};
1920
use libcnb::layer::UncachedLayerDefinition;
2021
use libcnb::layer_env::{LayerEnv, ModificationBehavior, Scope};
21-
use libcnb::Platform;
22-
use libcnb::{buildpack_main, Buildpack};
22+
use libcnb::{Buildpack, buildpack_main};
2323

2424
mod gem_list;
2525
mod layers;

buildpacks/ruby/src/rake_status.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ fn asset_manifest_from_glob(
100100
mod tests {
101101
use super::*;
102102
fn touch_file(path: &PathBuf, f: impl FnOnce(&PathBuf)) {
103-
if let Some(parent) = path.parent() {
104-
if !parent.exists() {
105-
fs_err::create_dir_all(parent).unwrap();
106-
}
103+
if let Some(parent) = path.parent()
104+
&& !parent.exists()
105+
{
106+
fs_err::create_dir_all(parent).unwrap();
107107
}
108108
fs_err::write(path, "").unwrap();
109109
f(path);

buildpacks/ruby/src/steps/default_env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::{RubyBuildpack, RubyBuildpackError};
22
use libcnb::layer::UncachedLayerDefinition;
33
use libcnb::layer_env::{LayerEnv, ModificationBehavior};
44
use libcnb::{
5+
Env,
56
build::BuildContext,
67
data::{layer_name, store::Store},
78
layer_env::Scope,
8-
Env,
99
};
1010
use rand::Rng;
1111

buildpacks/ruby/src/steps/detect_rake_tasks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::gem_list::GemList;
2-
use crate::rake_status::{check_rake_ready, RakeStatus};
3-
use crate::rake_task_detect::{self, RakeDetect};
41
use crate::RubyBuildpack;
52
use crate::RubyBuildpackError;
3+
use crate::gem_list::GemList;
4+
use crate::rake_status::{RakeStatus, check_rake_ready};
5+
use crate::rake_task_detect::{self, RakeDetect};
66
use bullet_stream::{global::print, style};
7-
use libcnb::build::BuildContext;
87
use libcnb::Env;
8+
use libcnb::build::BuildContext;
99

1010
pub(crate) fn detect_rake_tasks(
1111
gem_list: &GemList,

buildpacks/ruby/src/steps/get_default_process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::gem_list::GemList;
21
use crate::RubyBuildpack;
2+
use crate::gem_list::GemList;
33
use bullet_stream::global::print;
44
use bullet_stream::style;
55
use libcnb::build::BuildContext;

0 commit comments

Comments
 (0)