move Lint static def into its own module

This commit is contained in:
Jane Lusby
2019-06-08 11:47:24 -07:00
parent f6367c41dc
commit 5abcff2be5
3 changed files with 14 additions and 19 deletions

View File

@@ -95,20 +95,13 @@ fn update_lints(update_mode: &UpdateMode) {
sorted_usable_lints.sort_by_key(|lint| lint.name.clone()); sorted_usable_lints.sort_by_key(|lint| lint.name.clone());
std::fs::write( std::fs::write(
"../src/lintlist.rs", "../src/lintlist/mod.rs",
&format!( &format!(
"\ "\
//! This file is managed by util/dev update_lints. Do not edit. //! This file is managed by util/dev update_lints. Do not edit.
/// Lint data parsed from the Clippy source code. mod lint;
#[derive(Clone, PartialEq, Debug)] use lint::Lint;
pub struct Lint {{
pub name: &'static str,
pub group: &'static str,
pub desc: &'static str,
pub deprecation: Option<&'static str>,
pub module: &'static str,
}}
pub const ALL_LINTS: [Lint; {}] = {:#?};\n", pub const ALL_LINTS: [Lint; {}] = {:#?};\n",
sorted_usable_lints.len(), sorted_usable_lints.len(),

9
src/lintlist/lint.rs Normal file
View File

@@ -0,0 +1,9 @@
/// Lint data parsed from the Clippy source code.
#[derive(Clone, PartialEq, Debug)]
pub struct Lint {
pub name: &'static str,
pub group: &'static str,
pub desc: &'static str,
pub deprecation: Option<&'static str>,
pub module: &'static str,
}

View File

@@ -1,14 +1,7 @@
//! This file is managed by util/dev update_lints. Do not edit. //! This file is managed by util/dev update_lints. Do not edit.
/// Lint data parsed from the Clippy source code. mod lint;
#[derive(Clone, PartialEq, Debug)] use lint::Lint;
pub struct Lint {
pub name: &'static str,
pub group: &'static str,
pub desc: &'static str,
pub deprecation: Option<&'static str>,
pub module: &'static str,
}
pub const ALL_LINTS: [Lint; 304] = [ pub const ALL_LINTS: [Lint; 304] = [
Lint { Lint {