From 9cbb09015116460589ebd03ac97a8d467142f22d Mon Sep 17 00:00:00 2001 From: Schneems Date: Tue, 27 Aug 2024 11:28:50 -0500 Subject: [PATCH 1/3] Fix clippy warning Similar to: - https://github.com/heroku/buildpacks-python/blob/bb0264c8bb0c8b429951c97bf9fdfb894bb78878/Cargo.toml#L15-L16 - https://github.com/heroku/buildpacks-ruby/pull/314/commits/87c5302be420e394d3d8a2cbb6dc95df82ab6b79 ``` $ cargo clippy --all-targets --all-features -- --deny warnings Checking num-rational v0.4.2 Compiling libcnb-proc-macros v0.22.0 (/Users/rschneeman/Documents/projects/work/libcnb.rs/libcnb-proc-macros) Checking libcnb-common v0.22.0 (/Users/rschneeman/Documents/projects/work/libcnb.rs/libcnb-common) Checking time v0.3.30 Checking ahash v0.8.11 Checking opentelemetry_sdk v0.21.2 error: lint group `pedantic` has the same priority (0) as a lint --> Cargo.toml:33:1 | 33 | pedantic = "warn" | ^^^^^^^^ ------ has an implicit priority of 0 34 | unwrap_used = "warn" | ----------- has the same priority as this lint | = note: the order of the lints in the table is ignored by Cargo = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority = note: `#[deny(clippy::lint_groups_priority)]` on by default help: to have lints override the group set `pedantic` to a lower priority | 33 | pedantic = { level = "warn", priority = -1 } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c5b10edb..eaed2a04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,9 @@ unused_crate_dependencies = "warn" [workspace.lints.clippy] panic_in_result_fn = "warn" -pedantic = "warn" +# The explicit priority is required due to https://github.com/rust-lang/cargo/issues/13565. +pedantic = { level = "warn", priority = -1 } + unwrap_used = "warn" # In most cases adding error docs provides little value. missing_errors_doc = "allow" From 7dad43ff55c4c032d5829212780a432c816e4ac5 Mon Sep 17 00:00:00 2001 From: Schneems Date: Tue, 27 Aug 2024 11:32:38 -0500 Subject: [PATCH 2/3] Fix clippy lint ``` error: the borrowed expression implements the required traits --> libcnb-package/src/package.rs:67:24 | 67 | .manifest_path(&buildpack_directory.join("Cargo.toml")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `buildpack_directory.join("Cargo.toml")` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args = note: `-D clippy::needless-borrows-for-generic-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrows_for_generic_args)]` error: could not compile `libcnb-package` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... Error: Process completed with exit code 101. ``` --- libcnb-package/src/package.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcnb-package/src/package.rs b/libcnb-package/src/package.rs index b8bcc4f9..2066be6e 100644 --- a/libcnb-package/src/package.rs +++ b/libcnb-package/src/package.rs @@ -64,7 +64,7 @@ fn package_libcnb_buildpack( destination: &Path, ) -> Result<(), PackageLibcnbBuildpackError> { let cargo_metadata = MetadataCommand::new() - .manifest_path(&buildpack_directory.join("Cargo.toml")) + .manifest_path(buildpack_directory.join("Cargo.toml")) .exec() .map_err(PackageLibcnbBuildpackError::CargoMetadataError)?; From 5d925c92335634823ab1789aec5e62affff38de1 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 27 Aug 2024 18:03:42 +0100 Subject: [PATCH 3/3] Update Cargo.toml --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index eaed2a04..949ef4ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ unused_crate_dependencies = "warn" panic_in_result_fn = "warn" # The explicit priority is required due to https://github.com/rust-lang/cargo/issues/13565. pedantic = { level = "warn", priority = -1 } - unwrap_used = "warn" # In most cases adding error docs provides little value. missing_errors_doc = "allow"