diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-02-07 08:33:01 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-02-07 08:33:05 +0700 |
| commit | cf58537bd672807f8aa2b65be0ad88fd5a77b4f2 (patch) | |
| tree | 0fe6c08b6d3dd6b3321edafb80e67c2ad248fef5 /clippy_dev | |
| parent | 344603afcef264bc1790bca6865dbfb4815d2d5d (diff) | |
| download | rust-cf58537bd672807f8aa2b65be0ad88fd5a77b4f2.tar.gz rust-cf58537bd672807f8aa2b65be0ad88fd5a77b4f2.zip | |
dev: Move DOCS_LINK out of lazy_static and reuse it
Diffstat (limited to 'clippy_dev')
| -rw-r--r-- | clippy_dev/src/lib.rs | 5 | ||||
| -rw-r--r-- | clippy_dev/src/main.rs | 16 |
2 files changed, 12 insertions, 9 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index f50ef4aff95..3acecf96791 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -30,9 +30,10 @@ lazy_static! { ) .unwrap(); static ref NL_ESCAPE_RE: Regex = Regex::new(r#"\\\n\s*"#).unwrap(); - pub static ref DOCS_LINK: String = "https://rust-lang.github.io/rust-clippy/master/index.html".to_string(); } +pub static DOCS_LINK: &str = "https://rust-lang.github.io/rust-clippy/master/index.html"; + /// Lint data parsed from the Clippy source code. #[derive(Clone, PartialEq, Debug)] pub struct Lint { @@ -120,7 +121,7 @@ pub fn gen_changelog_lint_list(lints: Vec<Lint>) -> Vec<String> { if l.is_internal() { None } else { - Some(format!("[`{}`]: {}#{}", l.name, DOCS_LINK.clone(), l.name)) + Some(format!("[`{}`]: {}#{}", l.name, DOCS_LINK, l.name)) } }) .collect() diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs index 403aa634c34..15487681742 100644 --- a/clippy_dev/src/main.rs +++ b/clippy_dev/src/main.rs @@ -150,7 +150,7 @@ fn print_lints() { println!( "* [{}]({}#{}) ({})", lint.name, - clippy_dev::DOCS_LINK.clone(), + clippy_dev::DOCS_LINK, lint.name, lint.desc ); @@ -191,16 +191,18 @@ fn update_lints(update_mode: UpdateMode) { file_change |= replace_region_in_file( Path::new("README.md"), - r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"#, + &format!(r#"\[There are \d+ lints included in this crate!\]\({}\)"#, DOCS_LINK), "", true, update_mode == UpdateMode::Change, || { - vec", lint_count) - ] - } - ).changed; + vec", + lint_count, DOCS_LINK + )] + }, + ) + .changed; file_change |= replace_region_in_file( Path::new("CHANGELOG.md"), |
