Allow raw lint descriptions

update_lints now understands raw strings in declare_clippy_lint
descriptions.

Co-authored-by: Alex Macleod <alex@macleod.io>
This commit is contained in:
flip1995 2022-04-07 18:05:20 +01:00
parent abc59bb914
commit 6ab4508350
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5
5 changed files with 8 additions and 1 deletions

View File

@ -3272,6 +3272,7 @@ Released 2018-09-13
[`eq_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
[`equatable_if_let`]: https://rust-lang.github.io/rust-clippy/master/index.html#equatable_if_let
[`erasing_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op
[`err_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#err_expect
[`eval_order_dependence`]: https://rust-lang.github.io/rust-clippy/master/index.html#eval_order_dependence
[`excessive_precision`]: https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
[`exhaustive_enums`]: https://rust-lang.github.io/rust-clippy/master/index.html#exhaustive_enums

View File

@ -359,7 +359,7 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
// group,
Ident(group) Comma
// "description" }
Literal{kind: LiteralKind::Str{..}, ..}(desc) CloseBrace
Literal{..}(desc) CloseBrace
);
lints.push(Lint::new(name, group, desc, module));
}
@ -397,6 +397,9 @@ fn parse_deprecated_contents(contents: &str, lints: &mut Vec<DeprecatedLint>) {
/// Removes the line splices and surrounding quotes from a string literal
fn remove_line_splices(s: &str) -> String {
let s = s
.strip_prefix('r')
.unwrap_or(s)
.trim_matches('#')
.strip_prefix('"')
.and_then(|s| s.strip_suffix('"'))
.unwrap_or_else(|| panic!("expected quoted string, found `{}`", s));

View File

@ -157,6 +157,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
LintId::of(methods::CHARS_NEXT_CMP),
LintId::of(methods::CLONE_DOUBLE_REF),
LintId::of(methods::CLONE_ON_COPY),
LintId::of(methods::ERR_EXPECT),
LintId::of(methods::EXPECT_FUN_CALL),
LintId::of(methods::EXTEND_WITH_DRAIN),
LintId::of(methods::FILTER_MAP_IDENTITY),

View File

@ -286,6 +286,7 @@ store.register_lints(&[
methods::CLONE_DOUBLE_REF,
methods::CLONE_ON_COPY,
methods::CLONE_ON_REF_PTR,
methods::ERR_EXPECT,
methods::EXPECT_FUN_CALL,
methods::EXPECT_USED,
methods::EXTEND_WITH_DRAIN,

View File

@ -59,6 +59,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
LintId::of(methods::BYTES_NTH),
LintId::of(methods::CHARS_LAST_CMP),
LintId::of(methods::CHARS_NEXT_CMP),
LintId::of(methods::ERR_EXPECT),
LintId::of(methods::INTO_ITER_ON_REF),
LintId::of(methods::ITER_CLONED_COLLECT),
LintId::of(methods::ITER_NEXT_SLICE),