mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
impl !PartialOrd for HirId
This commit is contained in:
@@ -153,9 +153,15 @@ fn check_crate_post(&mut self, cx: &LateContext<'_>) {
|
||||
[] | [_] => return,
|
||||
[root, item] => {
|
||||
if !check_dup.contains(&(*item).to_string()) {
|
||||
used.entry(((*root).to_string(), span, hir_id))
|
||||
.or_insert_with(Vec::new)
|
||||
.push((*item).to_string());
|
||||
used.entry((
|
||||
(*root).to_string(),
|
||||
span,
|
||||
hir_id.local_id,
|
||||
cx.tcx.def_path_hash(hir_id.owner.def_id.into()),
|
||||
))
|
||||
.or_insert_with(|| (vec![], hir_id))
|
||||
.0
|
||||
.push((*item).to_string());
|
||||
check_dup.push((*item).to_string());
|
||||
}
|
||||
},
|
||||
@@ -171,15 +177,27 @@ fn check_crate_post(&mut self, cx: &LateContext<'_>) {
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
used.entry(((*root).to_string(), span, hir_id))
|
||||
.or_insert_with(Vec::new)
|
||||
.push(filtered.join("::"));
|
||||
used.entry((
|
||||
(*root).to_string(),
|
||||
span,
|
||||
hir_id.local_id,
|
||||
cx.tcx.def_path_hash(hir_id.owner.def_id.into()),
|
||||
))
|
||||
.or_insert_with(|| (vec![], hir_id))
|
||||
.0
|
||||
.push(filtered.join("::"));
|
||||
check_dup.extend(filtered);
|
||||
} else {
|
||||
let rest = rest.to_vec();
|
||||
used.entry(((*root).to_string(), span, hir_id))
|
||||
.or_insert_with(Vec::new)
|
||||
.push(rest.join("::"));
|
||||
used.entry((
|
||||
(*root).to_string(),
|
||||
span,
|
||||
hir_id.local_id,
|
||||
cx.tcx.def_path_hash(hir_id.owner.def_id.into()),
|
||||
))
|
||||
.or_insert_with(|| (vec![], hir_id))
|
||||
.0
|
||||
.push(rest.join("::"));
|
||||
check_dup.extend(rest.iter().map(ToString::to_string));
|
||||
}
|
||||
},
|
||||
@@ -190,7 +208,7 @@ fn check_crate_post(&mut self, cx: &LateContext<'_>) {
|
||||
// If mac_refs is not empty we have encountered an import we could not handle
|
||||
// such as `std::prelude::v1::foo` or some other macro that expands to an import.
|
||||
if self.mac_refs.is_empty() {
|
||||
for ((root, span, hir_id), path) in used {
|
||||
for ((root, span, ..), (path, hir_id)) in used {
|
||||
let import = if let [single] = &path[..] {
|
||||
format!("{root}::{single}")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user