Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rustc lint, warning when iterating over hashmaps 2 #92584

Merged
merged 3 commits into from
Feb 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustfmt is broken, manually reduce line length
  • Loading branch information
lcnr committed Feb 1, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
BridgeAR Ruben Bridgewater
commit 6970547d40108ba87cc64425c54c91a6caaebc5a
9 changes: 7 additions & 2 deletions compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
@@ -75,11 +75,16 @@ impl LateLintPass<'_> for QueryStability {
}

let (span, def_id, substs) = match expr.kind {
ExprKind::MethodCall(_, span, _, _) if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => {
ExprKind::MethodCall(_, span, _, _)
if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) =>
{
(span, def_id, cx.typeck_results().node_substs(expr.hir_id))
},
_ => {
let &ty::FnDef(def_id, substs) = cx.typeck_results().node_type(expr.hir_id).kind() else { return };
let &ty::FnDef(def_id, substs) =
cx.typeck_results()
.node_type(expr.hir_id)
.kind() else { return };
(expr.span, def_id, substs)
}
};