Skip to content

Commit 69d6688

Browse files
committed
Move lints into Cargo.toml
1 parent b9b034d commit 69d6688

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,31 @@ smallvec = { version = "1.13.1", features = ["union"] }
1919
[features]
2020
default = ["std"]
2121
std = []
22+
23+
[lints.rust]
24+
future_incompatible = "warn"
25+
let_underscore = "warn"
26+
missing_debug_implementations = "warn"
27+
rust_2018_idioms = "warn"
28+
rust_2021_compatibility = "warn"
29+
unreachable_pub = "warn"
30+
unsafe_code = "warn"
31+
unused = "warn"
32+
33+
[lints.clippy]
34+
pedantic = "warn"
35+
clone_on_ref_ptr = "warn"
36+
missing_const_for_fn = "warn"
37+
self_named_module_files = "warn"
38+
39+
# Repetitions of module/type names occur frequently when using many
40+
# modules for keeping the size of the source files handy. Often
41+
# types have the same name as their parent module.
42+
module_name_repetitions = "allow"
43+
44+
# Repeating the type name in `Default::default()` expressions
45+
# is not needed as long as the context is obvious.
46+
default_trait_access = "allow"
47+
48+
# The error types returned should be self-explanatory.
49+
missing_errors_doc = "allow"

examples/reservation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl PhoneNumber {
4646
}
4747

4848
impl PhoneNumber {
49-
pub fn len(&self) -> usize {
49+
fn len(&self) -> usize {
5050
self.0.chars().filter(|c| !c.is_whitespace()).count()
5151
}
5252
}
@@ -137,7 +137,7 @@ impl Quantity {
137137
Self(1)
138138
}
139139

140-
fn new(value: usize) -> Self {
140+
const fn new(value: usize) -> Self {
141141
Self(value)
142142
}
143143
}

src/lib.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
// SPDX-FileCopyrightText: slowtec GmbH
22
// SPDX-License-Identifier: MPL-2.0
33

4-
// Opt-in for allowed-by-default lints (in alphabetical order)
5-
// See also: <https://doc.rust-lang.org/rustc/lints>
6-
#![warn(future_incompatible)]
7-
#![warn(let_underscore)]
8-
#![warn(missing_debug_implementations)]
9-
#![warn(rust_2018_idioms)]
10-
#![warn(rust_2021_compatibility)]
11-
#![warn(unreachable_pub)]
12-
#![warn(unsafe_code)]
13-
#![warn(unused)]
14-
// Clippy lints
15-
#![warn(clippy::pedantic)]
16-
// Additional restrictions
17-
#![warn(clippy::clone_on_ref_ptr)]
18-
#![warn(clippy::missing_const_for_fn)]
19-
#![warn(clippy::mod_module_files)]
20-
// Repeating the type name in `..Default::default()` expressions
21-
// is not needed since the context is obvious.
22-
#![allow(clippy::default_trait_access)]
23-
// Opt-out of feature "std"
244
#![cfg_attr(not(feature = "std"), no_std)]
255

266
//! # semval

0 commit comments

Comments
 (0)