mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
Auto merge of #4206 - rust-lang:update_lints, r=phansch
Use replace_region_in_file for creating the lint list r? @phansch changelog: none
This commit is contained in:
commit
e5a77223f5
2 changed files with 36 additions and 26 deletions
|
@ -94,25 +94,26 @@ fn update_lints(update_mode: &UpdateMode) {
|
|||
let mut sorted_usable_lints = usable_lints.clone();
|
||||
sorted_usable_lints.sort_by_key(|lint| lint.name.clone());
|
||||
|
||||
std::fs::write(
|
||||
"../src/lintlist/mod.rs",
|
||||
&format!(
|
||||
"\
|
||||
//! This file is managed by `util/dev update_lints`. Do not edit.
|
||||
|
||||
pub mod lint;
|
||||
pub use lint::Level;
|
||||
pub use lint::Lint;
|
||||
pub use lint::LINT_LEVELS;
|
||||
|
||||
pub const ALL_LINTS: [Lint; {}] = {:#?};\n",
|
||||
sorted_usable_lints.len(),
|
||||
sorted_usable_lints
|
||||
),
|
||||
)
|
||||
.expect("can write to file");
|
||||
|
||||
let mut file_change = replace_region_in_file(
|
||||
"../src/lintlist/mod.rs",
|
||||
"begin lint list",
|
||||
"end lint list",
|
||||
false,
|
||||
update_mode == &UpdateMode::Change,
|
||||
|| {
|
||||
format!(
|
||||
"pub const ALL_LINTS: [Lint; {}] = {:#?};",
|
||||
sorted_usable_lints.len(),
|
||||
sorted_usable_lints
|
||||
)
|
||||
.lines()
|
||||
.map(ToString::to_string)
|
||||
.collect::<Vec<_>>()
|
||||
},
|
||||
)
|
||||
.changed;
|
||||
|
||||
file_change |= replace_region_in_file(
|
||||
"../README.md",
|
||||
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"#,
|
||||
"",
|
||||
|
|
|
@ -5,7 +5,8 @@ pub use lint::Level;
|
|||
pub use lint::Lint;
|
||||
pub use lint::LINT_LEVELS;
|
||||
|
||||
pub const ALL_LINTS: [Lint; 304] = [
|
||||
// begin lint list, do not remove this comment, it’s used in `update_lints`
|
||||
pub const ALL_LINTS: [Lint; 305] = [
|
||||
Lint {
|
||||
name: "absurd_extreme_comparisons",
|
||||
group: "correctness",
|
||||
|
@ -251,13 +252,6 @@ pub const ALL_LINTS: [Lint; 304] = [
|
|||
deprecation: None,
|
||||
module: "collapsible_if",
|
||||
},
|
||||
Lint {
|
||||
name: "const_static_lifetime",
|
||||
group: "style",
|
||||
desc: "Using explicit `\'static` lifetime for constants when elision rules would allow omitting them.",
|
||||
deprecation: None,
|
||||
module: "const_static_lifetime",
|
||||
},
|
||||
Lint {
|
||||
name: "copy_iterator",
|
||||
group: "pedantic",
|
||||
|
@ -762,6 +756,13 @@ pub const ALL_LINTS: [Lint; 304] = [
|
|||
deprecation: None,
|
||||
module: "arithmetic",
|
||||
},
|
||||
Lint {
|
||||
name: "integer_division",
|
||||
group: "pedantic",
|
||||
desc: "integer division may cause loss of precision",
|
||||
deprecation: None,
|
||||
module: "integer_division",
|
||||
},
|
||||
Lint {
|
||||
name: "into_iter_on_array",
|
||||
group: "correctness",
|
||||
|
@ -1525,6 +1526,13 @@ pub const ALL_LINTS: [Lint; 304] = [
|
|||
deprecation: None,
|
||||
module: "redundant_pattern_matching",
|
||||
},
|
||||
Lint {
|
||||
name: "redundant_static_lifetimes",
|
||||
group: "style",
|
||||
desc: "Using explicit `\'static` lifetime for constants or statics when elision rules would allow omitting them.",
|
||||
deprecation: None,
|
||||
module: "redundant_static_lifetimes",
|
||||
},
|
||||
Lint {
|
||||
name: "ref_in_deref",
|
||||
group: "complexity",
|
||||
|
@ -2135,3 +2143,4 @@ pub const ALL_LINTS: [Lint; 304] = [
|
|||
module: "unicode",
|
||||
},
|
||||
];
|
||||
// end lint list, do not remove this comment, it’s used in `update_lints`
|
||||
|
|
Loading…
Reference in a new issue