diff --git a/CHANGELOG.md b/CHANGELOG.md index 91fd027d..ff800841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Raised Minimum Supported Rust Version (MSRV) to `1.74`. ([#747](https://github.com/heroku/libcnb.rs/pull/747)) - Improved the consistency of all user-facing libcnb.rs error message wordings. ([#722](https://github.com/heroku/libcnb.rs/pull/722)) - The assistance error message shown when the necessary cross-compilation tools are not found now also includes the `rustup target add` step. ([#729](https://github.com/heroku/libcnb.rs/pull/729)) - Updated the documentation for `TestRunner::build` and `TestContext::start_container` to mention when Docker resource teardown occurs. ([#743](https://github.com/heroku/libcnb.rs/pull/743)) diff --git a/Cargo.toml b/Cargo.toml index 446826c4..09d677db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,10 +19,22 @@ members = [ [workspace.package] version = "0.15.0" -rust-version = "1.64" +rust-version = "1.74" edition = "2021" license = "BSD-3-Clause" +[workspace.lints.rust] +unused_crate_dependencies = "warn" + +[workspace.lints.clippy] +panic_in_result_fn = "warn" +pedantic = "warn" +unwrap_used = "warn" +# In most cases adding error docs provides little value. +missing_errors_doc = "allow" +# This lint is too noisy and enforces a style that reduces readability in many cases. +module_name_repetitions = "allow" + [workspace.dependencies] libcnb = { version = "=0.15.0", path = "libcnb" } libcnb-common = { version = "=0.15.0", path = "libcnb-common" } diff --git a/README.md b/README.md index 3ec6c35e..67e788b5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [docs.rs]: https://docs.rs/libcnb/latest/libcnb/ [Latest Version]: https://img.shields.io/crates/v/libcnb.svg [crates.io]: https://crates.io/crates/libcnb -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install `libcnb.rs` is a framework for writing [Cloud Native Buildpacks](https://buildpacks.io) in Rust. diff --git a/examples/basics/Cargo.toml b/examples/basics/Cargo.toml index 8a7bd18d..2c962f0f 100644 --- a/examples/basics/Cargo.toml +++ b/examples/basics/Cargo.toml @@ -5,5 +5,8 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] libcnb.workspace = true diff --git a/examples/basics/src/main.rs b/examples/basics/src/main.rs index ea4e76f3..973d96a8 100644 --- a/examples/basics/src/main.rs +++ b/examples/basics/src/main.rs @@ -1,7 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] - use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder}; use libcnb::detect::{DetectContext, DetectResult, DetectResultBuilder}; use libcnb::generic::{GenericError, GenericMetadata, GenericPlatform}; diff --git a/examples/execd/Cargo.toml b/examples/execd/Cargo.toml index 1456dd56..1a4c8018 100644 --- a/examples/execd/Cargo.toml +++ b/examples/execd/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] libcnb.workspace = true fastrand = "2.0.0" diff --git a/examples/execd/src/bin/dice_roller.rs b/examples/execd/src/bin/dice_roller.rs index 28ca5f70..f49d93ab 100644 --- a/examples/execd/src/bin/dice_roller.rs +++ b/examples/execd/src/bin/dice_roller.rs @@ -1,13 +1,13 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] - use libcnb::data::exec_d::ExecDProgramOutputKey; use libcnb::data::exec_d_program_output_key; use libcnb::exec_d::write_exec_d_program_output; use std::collections::HashMap; use std::iter; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +#[cfg(test)] +use libcnb_test as _; + fn main() { write_exec_d_program_output(env_vars()); } diff --git a/examples/execd/src/main.rs b/examples/execd/src/main.rs index 09f237f4..b395f751 100644 --- a/examples/execd/src/main.rs +++ b/examples/execd/src/main.rs @@ -1,9 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] - mod layer; use crate::layer::ExecDLayer; @@ -13,6 +7,11 @@ use libcnb::detect::{DetectContext, DetectResult, DetectResultBuilder}; use libcnb::generic::{GenericError, GenericMetadata, GenericPlatform}; use libcnb::{buildpack_main, Buildpack}; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +use fastrand as _; +#[cfg(test)] +use libcnb_test as _; + pub(crate) struct ExecDBuildpack; impl Buildpack for ExecDBuildpack { diff --git a/examples/execd/tests/integration_test.rs b/examples/execd/tests/integration_test.rs index 380b915b..2a37a08e 100644 --- a/examples/execd/tests/integration_test.rs +++ b/examples/execd/tests/integration_test.rs @@ -1,9 +1,8 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use libcnb_test::{assert_contains, assert_empty, BuildConfig, TestRunner}; diff --git a/examples/ruby-sample/Cargo.toml b/examples/ruby-sample/Cargo.toml index 93111b17..713b92a2 100644 --- a/examples/ruby-sample/Cargo.toml +++ b/examples/ruby-sample/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] flate2 = { version = "1.0.27", default-features = false, features = ["zlib"] } libcnb.workspace = true diff --git a/examples/ruby-sample/src/layers/bundler.rs b/examples/ruby-sample/src/layers/bundler.rs index 726a0607..547fc02c 100644 --- a/examples/ruby-sample/src/layers/bundler.rs +++ b/examples/ruby-sample/src/layers/bundler.rs @@ -30,6 +30,8 @@ impl Layer for BundlerLayer { } } + // TODO: Remove use of unwrap(): https://github.com/heroku/libcnb.rs/issues/746 + #[allow(clippy::unwrap_used)] fn create( &self, context: &BuildContext, @@ -84,6 +86,8 @@ impl Layer for BundlerLayer { }) } + // TODO: Remove use of unwrap(): https://github.com/heroku/libcnb.rs/issues/746 + #[allow(clippy::unwrap_used)] fn update( &self, context: &BuildContext, diff --git a/examples/ruby-sample/src/main.rs b/examples/ruby-sample/src/main.rs index 82071fa4..4430de4f 100644 --- a/examples/ruby-sample/src/main.rs +++ b/examples/ruby-sample/src/main.rs @@ -1,9 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] - use crate::layers::{BundlerLayer, RubyLayer}; use crate::util::{DownloadError, UntarError}; use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder}; @@ -16,6 +10,10 @@ use libcnb::{buildpack_main, Buildpack}; use serde::Deserialize; use std::process::ExitStatus; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +#[cfg(test)] +use libcnb_test as _; + mod layers; mod util; diff --git a/examples/ruby-sample/tests/integration_test.rs b/examples/ruby-sample/tests/integration_test.rs index 3b3abae0..15ebeebf 100644 --- a/examples/ruby-sample/tests/integration_test.rs +++ b/examples/ruby-sample/tests/integration_test.rs @@ -1,9 +1,8 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use libcnb_test::{ assert_contains, assert_not_contains, BuildConfig, ContainerConfig, PackResult, TestRunner, diff --git a/libcnb-cargo/Cargo.toml b/libcnb-cargo/Cargo.toml index 2fedc8fc..332cb02b 100644 --- a/libcnb-cargo/Cargo.toml +++ b/libcnb-cargo/Cargo.toml @@ -15,6 +15,9 @@ include = ["src/**/*", "LICENSE", "README.md"] name = "cargo-libcnb" path = "src/main.rs" +[lints] +workspace = true + [dependencies] clap = { version = "4.3.24", default-features = false, features = [ "derive", diff --git a/libcnb-cargo/README.md b/libcnb-cargo/README.md index 4b37c394..b0c41f22 100644 --- a/libcnb-cargo/README.md +++ b/libcnb-cargo/README.md @@ -53,5 +53,5 @@ pack build my-image-name \ [Latest Version]: https://img.shields.io/crates/v/libcnb-cargo.svg [crates.io]: https://crates.io/crates/libcnb-cargo -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-cargo/src/main.rs b/libcnb-cargo/src/main.rs index ff9d5a80..c616df5a 100644 --- a/libcnb-cargo/src/main.rs +++ b/libcnb-cargo/src/main.rs @@ -1,10 +1,4 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] // Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. #[cfg(test)] diff --git a/libcnb-cargo/tests/integration_test.rs b/libcnb-cargo/tests/integration_test.rs index f42df7aa..7ab2b972 100644 --- a/libcnb-cargo/tests/integration_test.rs +++ b/libcnb-cargo/tests/integration_test.rs @@ -1,9 +1,8 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use libcnb_common::toml_file::read_toml_file; use libcnb_data::buildpack::{BuildpackDescriptor, BuildpackId}; @@ -276,6 +275,8 @@ fn package_command_respects_ignore_files() { ); } +// Allow required due to: https://github.com/rust-lang/rust-clippy/issues/11119 +#[allow(clippy::unwrap_used)] fn validate_packaged_buildpack(packaged_buildpack_dir: &Path, buildpack_id: &BuildpackId) { assert!(packaged_buildpack_dir.join("buildpack.toml").exists()); assert!(packaged_buildpack_dir.join("package.toml").exists()); @@ -291,6 +292,8 @@ fn validate_packaged_buildpack(packaged_buildpack_dir: &Path, buildpack_id: &Bui ); } +// Allow required due to: https://github.com/rust-lang/rust-clippy/issues/11119 +#[allow(clippy::unwrap_used)] fn validate_packaged_composite_buildpack( packaged_buildpack_dir: &Path, buildpack_id: &BuildpackId, diff --git a/libcnb-common/Cargo.toml b/libcnb-common/Cargo.toml index 510c9ca5..be19f767 100644 --- a/libcnb-common/Cargo.toml +++ b/libcnb-common/Cargo.toml @@ -10,6 +10,9 @@ documentation = "https://docs.rs/libcnb-common" readme = "README.md" include = ["src/**/*", "LICENSE", "README.md"] +[lints] +workspace = true + [dependencies] serde = { version = "1.0.188", features = ["derive"] } thiserror = "1.0.48" diff --git a/libcnb-common/README.md b/libcnb-common/README.md index 1296fd83..5014d8d5 100644 --- a/libcnb-common/README.md +++ b/libcnb-common/README.md @@ -8,5 +8,5 @@ This is an internal crate and should not be used by users directly. There are no [docs.rs]: https://docs.rs/libcnb-proc-macros/latest/libcnb_common/ [Latest Version]: https://img.shields.io/crates/v/libcnb-common.svg [crates.io]: https://crates.io/crates/libcnb-common -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-common/src/lib.rs b/libcnb-common/src/lib.rs index acf829c7..40abc35f 100644 --- a/libcnb-common/src/lib.rs +++ b/libcnb-common/src/lib.rs @@ -1,9 +1,3 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] pub mod toml_file; diff --git a/libcnb-data/Cargo.toml b/libcnb-data/Cargo.toml index cdcfbc8a..4d8d154a 100644 --- a/libcnb-data/Cargo.toml +++ b/libcnb-data/Cargo.toml @@ -11,6 +11,9 @@ documentation = "https://docs.rs/libcnb-data" readme = "README.md" include = ["src/**/*", "LICENSE", "README.md"] +[lints] +workspace = true + [dependencies] fancy-regex = { version = "0.12.0", default-features = false, features = ["std"] } libcnb-proc-macros.workspace = true diff --git a/libcnb-data/README.md b/libcnb-data/README.md index a03e8f9a..cde3272c 100644 --- a/libcnb-data/README.md +++ b/libcnb-data/README.md @@ -10,5 +10,5 @@ on this crate directly. [docs.rs]: https://docs.rs/libcnb-data/latest/libcnb_data/ [Latest Version]: https://img.shields.io/crates/v/libcnb-data.svg [crates.io]: https://crates.io/crates/libcnb-data -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-data/src/lib.rs b/libcnb-data/src/lib.rs index 0a9fd2ab..04845a36 100644 --- a/libcnb-data/src/lib.rs +++ b/libcnb-data/src/lib.rs @@ -1,10 +1,4 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] pub mod build; pub mod build_plan; diff --git a/libcnb-package/Cargo.toml b/libcnb-package/Cargo.toml index 6cafbe64..55eaad3a 100644 --- a/libcnb-package/Cargo.toml +++ b/libcnb-package/Cargo.toml @@ -11,6 +11,9 @@ documentation = "https://docs.rs/libcnb-package" readme = "README.md" include = ["src/**/*", "LICENSE", "README.md"] +[lints] +workspace = true + [dependencies] cargo_metadata = "0.18.0" ignore = "0.4" diff --git a/libcnb-package/README.md b/libcnb-package/README.md index 4827f6b5..25386e0c 100644 --- a/libcnb-package/README.md +++ b/libcnb-package/README.md @@ -12,5 +12,5 @@ directly. [docs.rs]: https://docs.rs/libcnb-package/latest/libcnb_package/ [Latest Version]: https://img.shields.io/crates/v/libcnb-package.svg [crates.io]: https://crates.io/crates/libcnb-package -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-package/src/lib.rs b/libcnb-package/src/lib.rs index bc3c9bbe..ce15001b 100644 --- a/libcnb-package/src/lib.rs +++ b/libcnb-package/src/lib.rs @@ -1,10 +1,4 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] pub mod build; pub mod buildpack_dependency_graph; diff --git a/libcnb-proc-macros/Cargo.toml b/libcnb-proc-macros/Cargo.toml index ba400f55..b30ff6d4 100644 --- a/libcnb-proc-macros/Cargo.toml +++ b/libcnb-proc-macros/Cargo.toml @@ -13,6 +13,9 @@ include = ["src/**/*", "LICENSE", "README.md"] [lib] proc-macro = true +[lints] +workspace = true + [dependencies] cargo_metadata = "0.18.0" fancy-regex = { version = "0.12.0", default-features = false, features = ["std"] } diff --git a/libcnb-proc-macros/README.md b/libcnb-proc-macros/README.md index d18c25ef..85c369d7 100644 --- a/libcnb-proc-macros/README.md +++ b/libcnb-proc-macros/README.md @@ -9,5 +9,5 @@ depending on this crate directly. [docs.rs]: https://docs.rs/libcnb-proc-macros/latest/libcnb_proc_macros/ [Latest Version]: https://img.shields.io/crates/v/libcnb-proc-macros.svg [crates.io]: https://crates.io/crates/libcnb-proc-macros -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-proc-macros/src/lib.rs b/libcnb-proc-macros/src/lib.rs index 08a1dd89..70684172 100644 --- a/libcnb-proc-macros/src/lib.rs +++ b/libcnb-proc-macros/src/lib.rs @@ -1,8 +1,4 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] use proc_macro::TokenStream; use quote::quote; diff --git a/libcnb-test/Cargo.toml b/libcnb-test/Cargo.toml index 011b60c2..00e6dba9 100644 --- a/libcnb-test/Cargo.toml +++ b/libcnb-test/Cargo.toml @@ -11,6 +11,9 @@ documentation = "https://docs.rs/libcnb-test" readme = "README.md" include = ["src/**/*", "LICENSE", "README.md"] +[lints] +workspace = true + [dependencies] fastrand = "2.0.0" fs_extra = "1.3.0" diff --git a/libcnb-test/README.md b/libcnb-test/README.md index bdc9ade5..ee4ae648 100644 --- a/libcnb-test/README.md +++ b/libcnb-test/README.md @@ -226,5 +226,5 @@ fn additional_buildpacks() { [docs.rs]: https://docs.rs/libcnb-test/latest/libcnb_test/ [Latest Version]: https://img.shields.io/crates/v/libcnb-test.svg [crates.io]: https://crates.io/crates/libcnb-test -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libcnb-test/src/lib.rs b/libcnb-test/src/lib.rs index 186b1e5e..15002761 100644 --- a/libcnb-test/src/lib.rs +++ b/libcnb-test/src/lib.rs @@ -1,11 +1,4 @@ #![doc = include_str!("../README.md")] -// Enable lints that are disabled by default. -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] mod app; mod build; diff --git a/libcnb-test/tests/integration_test.rs b/libcnb-test/tests/integration_test.rs index 39ffc9c2..531377ed 100644 --- a/libcnb-test/tests/integration_test.rs +++ b/libcnb-test/tests/integration_test.rs @@ -5,9 +5,8 @@ //! to test dynamic values, in which case the only option is to use `panic::catch_unwind` //! since `should_panic` doesn't support globs/regular expressions/compile time macros. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use indoc::{formatdoc, indoc}; use libcnb_data::buildpack_id; diff --git a/libcnb/Cargo.toml b/libcnb/Cargo.toml index d3d00363..f788e8b0 100644 --- a/libcnb/Cargo.toml +++ b/libcnb/Cargo.toml @@ -11,6 +11,9 @@ documentation = "https://docs.rs/libcnb" readme = "README.md" include = ["src/**/*", "LICENSE", "README.md"] +[lints] +workspace = true + [dependencies] anyhow = { version = "1.0.75", optional = true } cyclonedx-bom = { version = "0.4.0", optional = true } diff --git a/libcnb/src/lib.rs b/libcnb/src/lib.rs index 37b1da1c..a65de479 100644 --- a/libcnb/src/lib.rs +++ b/libcnb/src/lib.rs @@ -1,12 +1,4 @@ #![doc = include_str!("../README.md")] -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// Most of libcnb's public API returns user-provided errors, making error docs redundant. -#![allow(clippy::missing_errors_doc)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] pub mod build; pub mod detect; diff --git a/libherokubuildpack/Cargo.toml b/libherokubuildpack/Cargo.toml index 56a3afa3..b96a8b0a 100644 --- a/libherokubuildpack/Cargo.toml +++ b/libherokubuildpack/Cargo.toml @@ -14,6 +14,9 @@ include = ["src/**/*", "LICENSE", "README.md"] [package.metadata.docs.rs] all-features = true +[lints] +workspace = true + [features] default = ["command", "download", "digest", "error", "log", "tar", "toml", "fs", "write"] download = ["dep:ureq", "dep:thiserror"] diff --git a/libherokubuildpack/README.md b/libherokubuildpack/README.md index 91f75470..3954e651 100644 --- a/libherokubuildpack/README.md +++ b/libherokubuildpack/README.md @@ -37,5 +37,5 @@ The feature names line up with the modules in this crate. All features are enabl [docs.rs]: https://docs.rs/libherokubuildpack/latest/libherokubuildpack/ [Latest Version]: https://img.shields.io/crates/v/libherokubuildpack.svg [crates.io]: https://crates.io/crates/libherokubuildpack -[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.64+-lightgray.svg +[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg [install-rust]: https://www.rust-lang.org/tools/install diff --git a/libherokubuildpack/src/lib.rs b/libherokubuildpack/src/lib.rs index faca25ba..60a9c376 100644 --- a/libherokubuildpack/src/lib.rs +++ b/libherokubuildpack/src/lib.rs @@ -1,13 +1,4 @@ #![doc = include_str!("../README.md")] -// Enable lints that are disabled by default. -#![warn(unused_crate_dependencies)] -#![warn(clippy::pedantic)] -#![warn(clippy::panic_in_result_fn)] -#![warn(clippy::unwrap_used)] -// In most cases adding error docs provides little value. -#![allow(clippy::missing_errors_doc)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] #[cfg(feature = "command")] pub mod command; diff --git a/test-buildpacks/readonly-layer-files/Cargo.toml b/test-buildpacks/readonly-layer-files/Cargo.toml index 6fc0f7a9..55be9c2b 100644 --- a/test-buildpacks/readonly-layer-files/Cargo.toml +++ b/test-buildpacks/readonly-layer-files/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] libcnb.workspace = true diff --git a/test-buildpacks/readonly-layer-files/src/main.rs b/test-buildpacks/readonly-layer-files/src/main.rs index 42b918fe..bd48774e 100644 --- a/test-buildpacks/readonly-layer-files/src/main.rs +++ b/test-buildpacks/readonly-layer-files/src/main.rs @@ -1,9 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] - mod layer; use crate::layer::TestLayer; @@ -14,6 +8,10 @@ use libcnb::generic::{GenericMetadata, GenericPlatform}; use libcnb::{buildpack_main, Buildpack}; use std::io::Error; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +#[cfg(test)] +use libcnb_test as _; + pub struct TestBuildpack; impl Buildpack for TestBuildpack { diff --git a/test-buildpacks/readonly-layer-files/tests/integration_test.rs b/test-buildpacks/readonly-layer-files/tests/integration_test.rs index 8b43f30c..4629c887 100644 --- a/test-buildpacks/readonly-layer-files/tests/integration_test.rs +++ b/test-buildpacks/readonly-layer-files/tests/integration_test.rs @@ -1,9 +1,8 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use libcnb_test::{BuildConfig, TestRunner}; use std::env::temp_dir; diff --git a/test-buildpacks/sbom/Cargo.toml b/test-buildpacks/sbom/Cargo.toml index 82a322a2..a279a49a 100644 --- a/test-buildpacks/sbom/Cargo.toml +++ b/test-buildpacks/sbom/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] libcnb.workspace = true diff --git a/test-buildpacks/sbom/src/main.rs b/test-buildpacks/sbom/src/main.rs index d828eadf..6fbb4785 100644 --- a/test-buildpacks/sbom/src/main.rs +++ b/test-buildpacks/sbom/src/main.rs @@ -1,9 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] - mod test_layer; mod test_layer_2; @@ -18,6 +12,10 @@ use libcnb::sbom::Sbom; use libcnb::{buildpack_main, Buildpack}; use std::io::Error; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +#[cfg(test)] +use libcnb_test as _; + pub struct TestBuildpack; impl Buildpack for TestBuildpack { diff --git a/test-buildpacks/sbom/tests/integration_test.rs b/test-buildpacks/sbom/tests/integration_test.rs index 519a451b..df5f35b9 100644 --- a/test-buildpacks/sbom/tests/integration_test.rs +++ b/test-buildpacks/sbom/tests/integration_test.rs @@ -1,10 +1,6 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] - use libcnb::data::buildpack_id; use libcnb::data::layer_name; use libcnb::data::sbom::SbomFormat; diff --git a/test-buildpacks/store/Cargo.toml b/test-buildpacks/store/Cargo.toml index f1c3b410..839bcbab 100644 --- a/test-buildpacks/store/Cargo.toml +++ b/test-buildpacks/store/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true rust-version.workspace = true publish = false +[lints] +workspace = true + [dependencies] libcnb.workspace = true toml.workspace = true diff --git a/test-buildpacks/store/src/main.rs b/test-buildpacks/store/src/main.rs index cf733f44..aeec33f7 100644 --- a/test-buildpacks/store/src/main.rs +++ b/test-buildpacks/store/src/main.rs @@ -1,9 +1,3 @@ -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] -// This lint is too noisy and enforces a style that reduces readability in many cases. -#![allow(clippy::module_name_repetitions)] - use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder}; use libcnb::data::store::Store; use libcnb::detect::{DetectContext, DetectResult, DetectResultBuilder}; @@ -12,6 +6,10 @@ use libcnb::{buildpack_main, Buildpack}; use std::io::Error; use toml::toml; +// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well. +#[cfg(test)] +use libcnb_test as _; + pub struct TestBuildpack; impl Buildpack for TestBuildpack { diff --git a/test-buildpacks/store/tests/integration_test.rs b/test-buildpacks/store/tests/integration_test.rs index 4ea30f4d..5b9f7375 100644 --- a/test-buildpacks/store/tests/integration_test.rs +++ b/test-buildpacks/store/tests/integration_test.rs @@ -1,9 +1,8 @@ //! All integration tests are skipped by default (using the `ignore` attribute) //! since performing builds is slow. To run them use: `cargo test -- --ignored`. -// Enable Clippy lints that are disabled by default. -// https://rust-lang.github.io/rust-clippy/stable/index.html -#![warn(clippy::pedantic)] +// Required due to: https://github.com/rust-lang/rust/issues/95513 +#![allow(unused_crate_dependencies)] use libcnb_test::{assert_contains, BuildConfig, TestRunner}; use std::env::temp_dir;