Skip to content

Commit 1c5e136

Browse files
authored
Switch to Cargo.toml based lint configuration (#195)
As of the Cargo included in Rust 1.74, lints can now be configured in `Cargo.toml` across whole crates/workspaces: https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section This reduces the boilerplate, and the chance that we forget to enable lints in some targets. Since this feature requires Rust 1.74, the MSRV has also been bumped. GUS-W-14523760.
1 parent d8f54ae commit 1c5e136

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

Diff for: Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ name = "procfile-buildpack"
44
version = "0.0.0"
55
publish = false
66
edition = "2021"
7-
rust-version = "1.66"
7+
rust-version = "1.74"
8+
9+
[lints.rust]
10+
unused_crate_dependencies = "warn"
11+
12+
[lints.clippy]
13+
pedantic = "warn"
814

915
[dependencies]
1016
indoc = "2"

Diff for: src/error.rs

+6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ use indoc::formatdoc;
44
use libherokubuildpack::log::log_error;
55

66
#[derive(Debug)]
7+
// This allow can be removed once the visibility of this enum is fixed,
8+
// since the lint only applies to public APIs.
9+
#[allow(clippy::module_name_repetitions)]
710
pub enum ProcfileBuildpackError {
811
CannotReadProcfileContents(std::io::Error),
912
ProcfileParsingError(ProcfileParsingError),
1013
ProcfileConversionError(ProcfileConversionError),
1114
}
1215

16+
// This allow can be removed once the visibility of this enum is fixed,
17+
// since the lint only applies to public APIs.
18+
#[allow(clippy::module_name_repetitions)]
1319
pub fn error_handler(buildpack_error: ProcfileBuildpackError) {
1420
match buildpack_error {
1521
ProcfileBuildpackError::CannotReadProcfileContents(io_error) => {

Diff for: src/main.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Enable rustc and Clippy lints that are disabled by default.
2-
// https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unused-crate-dependencies
3-
#![warn(unused_crate_dependencies)]
4-
// https://rust-lang.github.io/rust-clippy/stable/index.html
5-
#![warn(clippy::pedantic)]
6-
// Re-disable pedantic lints that are too noisy/unwanted.
7-
#![allow(clippy::module_name_repetitions)]
8-
91
mod error;
102
mod launch;
113
mod procfile;

Diff for: src/procfile.rs

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ impl FromStr for Procfile {
6464
// There are currently no ways in which parsing can fail, however we will add some in the future:
6565
// https://github.com/heroku/procfile-cnb/issues/73
6666
#[derive(Debug, Eq, PartialEq)]
67+
// This allow can be removed once the visibility of this enum is fixed,
68+
// since the lint only applies to public APIs.
69+
#[allow(clippy::module_name_repetitions)]
6770
pub enum ProcfileParsingError {}
6871

6972
#[cfg(test)]

Diff for: tests/integration_test.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
//! Integration tests using libcnb-test.
2-
//!
3-
//! All integration tests are skipped by default (using the `ignore` attribute),
4-
//! since performing builds is slow. To run the tests use: `cargo test -- --ignored`
1+
//! All integration tests are skipped by default (using the `ignore` attribute)
2+
//! since performing builds is slow. To run them use: `cargo test -- --ignored`.
53
6-
// Enable Clippy lints that are disabled by default.
7-
#![warn(clippy::pedantic)]
4+
// Required due to: https://github.com/rust-lang/rust/issues/95513
5+
#![allow(unused_crate_dependencies)]
86

97
use indoc::indoc;
108
use libcnb_test::{assert_contains, BuildConfig, ContainerConfig, PackResult, TestRunner};

0 commit comments

Comments
 (0)