Skip to content

Commit 984330a

Browse files
committed
Auto merge of #8657 - flip1995:raw_lint_desc, r=flip1995
Allow raw lint descriptions update_lints now understands raw strings in declare_clippy_lint descriptions. Supersedes #8655 cc `@Alexendoo` thanks for addressing this so quickly. I build a little bit simpler version of your patch. I don't think it really matters what `Literal` we're trying to tokenize, since we assume later, that it is some sort of `str`. changelog: none
2 parents abc59bb + 6ab4508 commit 984330a

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3272,6 +3272,7 @@ Released 2018-09-13
32723272
[`eq_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
32733273
[`equatable_if_let`]: https://rust-lang.github.io/rust-clippy/master/index.html#equatable_if_let
32743274
[`erasing_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op
3275+
[`err_expect`]: https://rust-lang.github.io/rust-clippy/master/index.html#err_expect
32753276
[`eval_order_dependence`]: https://rust-lang.github.io/rust-clippy/master/index.html#eval_order_dependence
32763277
[`excessive_precision`]: https://rust-lang.github.io/rust-clippy/master/index.html#excessive_precision
32773278
[`exhaustive_enums`]: https://rust-lang.github.io/rust-clippy/master/index.html#exhaustive_enums

clippy_dev/src/update_lints.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
359359
// group,
360360
Ident(group) Comma
361361
// "description" }
362-
Literal{kind: LiteralKind::Str{..}, ..}(desc) CloseBrace
362+
Literal{..}(desc) CloseBrace
363363
);
364364
lints.push(Lint::new(name, group, desc, module));
365365
}
@@ -397,6 +397,9 @@ fn parse_deprecated_contents(contents: &str, lints: &mut Vec<DeprecatedLint>) {
397397
/// Removes the line splices and surrounding quotes from a string literal
398398
fn remove_line_splices(s: &str) -> String {
399399
let s = s
400+
.strip_prefix('r')
401+
.unwrap_or(s)
402+
.trim_matches('#')
400403
.strip_prefix('"')
401404
.and_then(|s| s.strip_suffix('"'))
402405
.unwrap_or_else(|| panic!("expected quoted string, found `{}`", s));

clippy_lints/src/lib.register_all.rs

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
157157
LintId::of(methods::CHARS_NEXT_CMP),
158158
LintId::of(methods::CLONE_DOUBLE_REF),
159159
LintId::of(methods::CLONE_ON_COPY),
160+
LintId::of(methods::ERR_EXPECT),
160161
LintId::of(methods::EXPECT_FUN_CALL),
161162
LintId::of(methods::EXTEND_WITH_DRAIN),
162163
LintId::of(methods::FILTER_MAP_IDENTITY),

clippy_lints/src/lib.register_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ store.register_lints(&[
286286
methods::CLONE_DOUBLE_REF,
287287
methods::CLONE_ON_COPY,
288288
methods::CLONE_ON_REF_PTR,
289+
methods::ERR_EXPECT,
289290
methods::EXPECT_FUN_CALL,
290291
methods::EXPECT_USED,
291292
methods::EXTEND_WITH_DRAIN,

clippy_lints/src/lib.register_style.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
5959
LintId::of(methods::BYTES_NTH),
6060
LintId::of(methods::CHARS_LAST_CMP),
6161
LintId::of(methods::CHARS_NEXT_CMP),
62+
LintId::of(methods::ERR_EXPECT),
6263
LintId::of(methods::INTO_ITER_ON_REF),
6364
LintId::of(methods::ITER_CLONED_COLLECT),
6465
LintId::of(methods::ITER_NEXT_SLICE),

0 commit comments

Comments
 (0)