Skip to content

Commit a59da03

Browse files
flip1995Manishearth
authored andcommitted
Add hint for cfg_attr and fix test
1 parent 3720557 commit a59da03

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/librustc/lint/levels.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -280,25 +280,27 @@ impl<'a> LintLevelsBuilder<'a> {
280280
let (lvl, src) =
281281
self.sets
282282
.get_lint_level(lint, self.cur, Some(&specs), &sess);
283+
let msg = format!(
284+
"lint name `{}` is deprecated \
285+
and may not have an effect in the future \
286+
Also `cfg_attr(cargo-clippy)` won't be necessary anymore",
287+
name
288+
);
283289
let mut err = lint::struct_lint_level(
284290
self.sess,
285291
lint,
286292
lvl,
287293
src,
288294
Some(li.span.into()),
289-
&format!(
290-
"lint name `{}` is deprecated \
291-
and may not have an effect in the future",
292-
name
293-
),
295+
&msg,
294296
);
295297
err.span_suggestion_with_applicability(
296298
li.span,
297299
"change it to",
298300
new_lint_name.to_string(),
299301
Applicability::MachineApplicable,
300-
);
301-
err.emit();
302+
).emit();
303+
302304
let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
303305
for id in ids {
304306
specs.insert(*id, (level, src));

src/test/ui-fulldeps/lint_tool_test.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![allow(dead_code)]
1717
#![deny(clippy_group)]
1818
//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
19+
//~^^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
1920

2021
fn lintme() { } //~ ERROR item is named 'lintme'
2122

src/test/ui-fulldeps/lint_tool_test.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
warning: lint name `clippy_group` is deprecated and may not have an effect in the future
1+
warning: lint name `clippy_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
22
--> $DIR/lint_tool_test.rs:17:9
33
|
44
LL | #![deny(clippy_group)]
55
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
66
|
77
= note: #[warn(renamed_and_removed_lints)] on by default
88

9-
warning: lint name `test_group` is deprecated and may not have an effect in the future
10-
--> $DIR/lint_tool_test.rs:31:9
9+
warning: lint name `test_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
10+
--> $DIR/lint_tool_test.rs:32:9
1111
|
1212
LL | #[allow(test_group)]
1313
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
1414

1515
warning: unknown lint: `this_lint_does_not_exist`
16-
--> $DIR/lint_tool_test.rs:33:8
16+
--> $DIR/lint_tool_test.rs:34:8
1717
|
1818
LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^
2020
|
2121
= note: #[warn(unknown_lints)] on by default
2222

23-
warning: lint name `clippy_group` is deprecated and may not have an effect in the future
23+
warning: lint name `clippy_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
2424
--> $DIR/lint_tool_test.rs:17:9
2525
|
2626
LL | #![deny(clippy_group)]
2727
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
2828

2929
error: item is named 'lintme'
30-
--> $DIR/lint_tool_test.rs:20:1
30+
--> $DIR/lint_tool_test.rs:21:1
3131
|
3232
LL | fn lintme() { } //~ ERROR item is named 'lintme'
3333
| ^^^^^^^^^^^^^^^
@@ -40,7 +40,7 @@ LL | #![deny(clippy_group)]
4040
= note: #[deny(clippy::test_lint)] implied by #[deny(clippy::group)]
4141

4242
error: item is named 'lintmetoo'
43-
--> $DIR/lint_tool_test.rs:28:5
43+
--> $DIR/lint_tool_test.rs:29:5
4444
|
4545
LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
4646
| ^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)