Skip to content

Commit a2f99b7

Browse files
committed
Move lint configuration to Cargo.toml
1 parent 578bd87 commit a2f99b7

File tree

4 files changed

+104
-101
lines changed

4 files changed

+104
-101
lines changed

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- uses: baptiste0928/cargo-install@v2
3636
with:
3737
crate: cargo-make
38-
- run: cargo make lint-stable
38+
- run: cargo make lint-stable -- --deny warnings
3939
docs:
4040
runs-on: ubuntu-latest
4141
timeout-minutes: 10

Cargo.toml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,104 @@ assets = [
8282
["CHANGELOG.md", "usr/share/doc/interactive-rebase-tool/", "644"],
8383
["src/interactive-rebase-tool.1", "usr/share/man/man1/interactive-rebase-tool.1", "644"]
8484
]
85+
86+
[lints.rust]
87+
future_incompatible = {level = "warn", priority = -2}
88+
nonstandard_style = {level = "warn", priority = -2}
89+
rust_2018_compatibility = {level = "warn", priority = -2}
90+
rust_2018_idioms = {level = "warn", priority = -2}
91+
rust_2021_compatibility = {level = "warn", priority = -2}
92+
unused = {level = "warn", priority = -2}
93+
94+
unknown_lints = {level = "warn", priority = -1}
95+
renamed_and_removed_lints = {level = "warn", priority = -1}
96+
97+
absolute_paths_not_starting_with_crate = "warn"
98+
deprecated_in_future = "warn"
99+
dead_code = "warn"
100+
elided_lifetimes_in_paths = "warn"
101+
explicit_outlives_requirements = "warn"
102+
ffi_unwind_calls = "warn"
103+
keyword_idents = "warn"
104+
let_underscore_drop = "warn"
105+
macro_use_extern_crate = "warn"
106+
meta_variable_misuse = "warn"
107+
missing_abi = "warn"
108+
missing_copy_implementations = "warn"
109+
missing_debug_implementations = "warn"
110+
non_ascii_idents = "warn"
111+
noop_method_call = "warn"
112+
pointer_structural_match = "warn"
113+
rust_2021_incompatible_closure_captures = "warn"
114+
rust_2021_incompatible_or_patterns = "warn"
115+
rust_2021_prefixes_incompatible_syntax = "warn"
116+
rust_2021_prelude_collisions = "warn"
117+
single_use_lifetimes = "warn"
118+
trivial_casts = "warn"
119+
trivial_numeric_casts = "warn"
120+
unreachable_pub = "warn"
121+
unsafe_code = "warn"
122+
unsafe_op_in_unsafe_fn = "warn"
123+
unused_crate_dependencies = "warn"
124+
unused_extern_crates = "warn"
125+
unused_import_braces = "warn"
126+
unused_lifetimes = "warn"
127+
unused_macro_rules = "warn"
128+
unused_qualifications = "warn"
129+
unused_results = "warn"
130+
unused_tuple_struct_fields = "warn"
131+
variant_size_differences = "warn"
132+
133+
[lints.clippy]
134+
all = {level = "warn", priority = -2}
135+
cargo = {level = "warn", priority = -2}
136+
pedantic = {level = "warn", priority = -2}
137+
restriction = {level = "warn", priority = -2}
138+
139+
blanket_clippy_restriction_lints = {level = "allow", priority = 5}
140+
absolute_paths = "allow"
141+
as_conversions = "allow"
142+
arithmetic_side_effects = "allow"
143+
bool_to_int_with_if = "allow"
144+
default_numeric_fallback = "allow"
145+
else_if_without_else = "allow"
146+
expect_used = "allow"
147+
float_arithmetic = "allow"
148+
implicit_return = "allow"
149+
indexing_slicing = "allow"
150+
map_err_ignore = "allow"
151+
min_ident_chars = "allow"
152+
missing_docs_in_private_items = "allow"
153+
missing_trait_methods = "allow"
154+
module_name_repetitions = "allow"
155+
needless_raw_string_hashes = "allow"
156+
needless_raw_strings = "allow"
157+
new_without_default = "allow"
158+
non_ascii_literal = "allow"
159+
option_if_let_else = "allow"
160+
pattern_type_mismatch = "allow"
161+
pub_use = "allow"
162+
pub_with_shorthand = "allow"
163+
question_mark_used = "allow"
164+
redundant_closure_call = "allow"
165+
redundant_closure_for_method_calls = "allow"
166+
redundant_pub_crate = "allow"
167+
ref_patterns = "allow"
168+
self_named_module_files = "allow"
169+
single_call_fn = "allow"
170+
std_instead_of_alloc = "allow"
171+
std_instead_of_core = "allow"
172+
tabs_in_doc_comments = "allow"
173+
tests_outside_test_module = "allow"
174+
too_many_lines = "allow"
175+
unwrap_used = "allow"
176+
wildcard_enum_match_arm = "allow"
177+
178+
[lints.rustdoc]
179+
bare_urls = "warn"
180+
broken_intra_doc_links = "warn"
181+
invalid_codeblock_attributes = "warn"
182+
invalid_html_tags = "warn"
183+
missing_crate_level_docs = "allow"
184+
private_doc_tests = "warn"
185+
private_intra_doc_links = "warn"

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn git_revision_hash() -> Option<String> {
3030
.args(["rev-parse", "--short=10", "HEAD"])
3131
.output();
3232
result.ok().and_then(|output| {
33-
let v = String::from_utf8_lossy(&output.stdout).trim().to_string();
33+
let v = String::from(String::from_utf8_lossy(&output.stdout).trim());
3434
if v.is_empty() { None } else { Some(v) }
3535
})
3636
}

src/main.rs

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,5 @@
11
// nightly sometimes removes/renames lints
2-
#![cfg_attr(allow_unknown_lints, allow(unknown_lints))]
3-
#![cfg_attr(allow_unknown_lints, allow(renamed_and_removed_lints))]
4-
// enable all rustc's built-in lints
5-
#![warn(
6-
future_incompatible,
7-
nonstandard_style,
8-
rust_2018_compatibility,
9-
rust_2018_idioms,
10-
rust_2021_compatibility,
11-
unused
12-
)]
13-
// rustc's additional allowed by default lints
14-
#![deny(
15-
absolute_paths_not_starting_with_crate,
16-
deprecated_in_future,
17-
elided_lifetimes_in_paths,
18-
explicit_outlives_requirements,
19-
ffi_unwind_calls,
20-
keyword_idents,
21-
let_underscore_drop,
22-
macro_use_extern_crate,
23-
meta_variable_misuse,
24-
missing_abi,
25-
missing_copy_implementations,
26-
missing_debug_implementations,
27-
non_ascii_idents,
28-
noop_method_call,
29-
pointer_structural_match,
30-
rust_2021_incompatible_closure_captures,
31-
rust_2021_incompatible_or_patterns,
32-
rust_2021_prefixes_incompatible_syntax,
33-
rust_2021_prelude_collisions,
34-
single_use_lifetimes,
35-
trivial_casts,
36-
trivial_numeric_casts,
37-
unreachable_pub,
38-
unsafe_code,
39-
unsafe_op_in_unsafe_fn,
40-
unused_crate_dependencies,
41-
unused_extern_crates,
42-
unused_import_braces,
43-
unused_lifetimes,
44-
unused_macro_rules,
45-
unused_qualifications,
46-
unused_results,
47-
unused_tuple_struct_fields,
48-
variant_size_differences
49-
)]
50-
// enable all of Clippy's lints
51-
#![deny(clippy::all, clippy::cargo, clippy::pedantic, clippy::restriction)]
52-
#![allow(
53-
clippy::absolute_paths,
54-
clippy::arithmetic_side_effects,
55-
clippy::arithmetic_side_effects,
56-
clippy::as_conversions,
57-
clippy::blanket_clippy_restriction_lints,
58-
clippy::bool_to_int_with_if,
59-
clippy::default_numeric_fallback,
60-
clippy::else_if_without_else,
61-
clippy::expect_used,
62-
clippy::float_arithmetic,
63-
clippy::implicit_return,
64-
clippy::indexing_slicing,
65-
clippy::map_err_ignore,
66-
clippy::min_ident_chars,
67-
clippy::missing_docs_in_private_items,
68-
clippy::missing_trait_methods,
69-
clippy::module_name_repetitions,
70-
clippy::needless_raw_string_hashes,
71-
clippy::needless_raw_strings,
72-
clippy::new_without_default,
73-
clippy::non_ascii_literal,
74-
clippy::option_if_let_else,
75-
clippy::pattern_type_mismatch,
76-
clippy::pub_use,
77-
clippy::pub_with_shorthand,
78-
clippy::question_mark_used,
79-
clippy::redundant_closure_call,
80-
clippy::redundant_closure_for_method_calls,
81-
clippy::redundant_pub_crate,
82-
clippy::ref_patterns,
83-
clippy::self_named_module_files,
84-
clippy::single_call_fn,
85-
clippy::std_instead_of_alloc,
86-
clippy::std_instead_of_core,
87-
clippy::tabs_in_doc_comments,
88-
clippy::tests_outside_test_module,
89-
clippy::too_many_lines,
90-
clippy::unwrap_used,
91-
clippy::wildcard_enum_match_arm
92-
)]
93-
#![deny(
94-
rustdoc::bare_urls,
95-
rustdoc::broken_intra_doc_links,
96-
rustdoc::invalid_codeblock_attributes,
97-
rustdoc::invalid_html_tags,
98-
rustdoc::private_doc_tests,
99-
rustdoc::private_intra_doc_links
100-
)]
2+
#![cfg_attr(allow_unknown_lints, allow(unknown_lints, renamed_and_removed_lints))]
1013
// allow some things in tests
1024
#![cfg_attr(
1035
test,

0 commit comments

Comments
 (0)