Skip to content

Commit 7708abb

Browse files
jumbatmlcnr
andcommitted
Avoid double hashset lookup.
Co-authored-by: Bastian Kauschke <[email protected]>
1 parent 6c57de1 commit 7708abb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,12 +2161,11 @@ impl ClashingExternDeclarations {
21612161
ckind: CItemKind,
21622162
) -> bool {
21632163
debug!("structurally_same_type_impl(cx, a = {:?}, b = {:?})", a, b);
2164-
if seen_types.contains(&(a, b)) {
2164+
if !seen_types.insert((a, b)) {
21652165
// We've encountered a cycle. There's no point going any further -- the types are
21662166
// structurally the same.
21672167
return true;
21682168
}
2169-
seen_types.insert((a, b));
21702169
let tcx = cx.tcx;
21712170
if a == b || rustc_middle::ty::TyS::same_type(a, b) {
21722171
// All nominally-same types are structurally same, too.

0 commit comments

Comments
 (0)