Skip to content

Commit 69c4ff6

Browse files
committed
Emit unnecessary_def_path in source order.
1 parent e825adf commit 69c4ff6

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Diff for: clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::source::snippet_with_applicability;
33
use clippy_utils::{def_path_def_ids, is_lint_allowed, match_any_def_paths, peel_hir_expr_refs};
44
use if_chain::if_chain;
55
use rustc_ast::ast::LitKind;
6-
use rustc_data_structures::fx::FxHashSet;
6+
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
77
use rustc_errors::Applicability;
88
use rustc_hir as hir;
99
use rustc_hir::def::{DefKind, Res};
@@ -44,7 +44,7 @@ impl_lint_pass!(UnnecessaryDefPath => [UNNECESSARY_DEF_PATH]);
4444

4545
#[derive(Default)]
4646
pub struct UnnecessaryDefPath {
47-
array_def_ids: FxHashSet<(DefId, Span)>,
47+
array_def_ids: FxIndexSet<(DefId, Span)>,
4848
linted_def_ids: FxHashSet<DefId>,
4949
}
5050

Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
error: hardcoded path to a diagnostic item
2-
--> $DIR/unnecessary_def_path_hardcoded_path.rs:12:43
3-
|
4-
LL | const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= help: convert all references to use `sym::deref_method`
8-
= note: `-D clippy::unnecessary-def-path` implied by `-D warnings`
9-
101
error: hardcoded path to a diagnostic item
112
--> $DIR/unnecessary_def_path_hardcoded_path.rs:10:36
123
|
134
LL | const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"];
145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156
|
167
= help: convert all references to use `sym::Deref`
8+
= note: `-D clippy::unnecessary-def-path` implied by `-D warnings`
179

1810
error: hardcoded path to a language item
1911
--> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40
@@ -23,5 +15,13 @@ LL | const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"]
2315
|
2416
= help: convert all references to use `LangItem::DerefMut`
2517

18+
error: hardcoded path to a diagnostic item
19+
--> $DIR/unnecessary_def_path_hardcoded_path.rs:12:43
20+
|
21+
LL | const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
22+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
|
24+
= help: convert all references to use `sym::deref_method`
25+
2626
error: aborting due to 3 previous errors
2727

0 commit comments

Comments
 (0)