Rollup merge of #151376 - chenyukang:yukang-fix-perf, r=lqd
Fix performance issue in liveness checking r? @ghost from https://github.com/rust-lang/rust/pull/150955#issuecomment-3769274223
This commit is contained in:
commit
a4b553804b
1 changed files with 5 additions and 5 deletions
|
|
@ -1086,11 +1086,6 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> {
|
|||
|
||||
let Some((name, decl_span)) = self.checked_places.names[index] else { continue };
|
||||
|
||||
// By convention, underscore-prefixed bindings are explicitly allowed to be unused.
|
||||
if name.as_str().starts_with('_') {
|
||||
continue;
|
||||
}
|
||||
|
||||
let is_maybe_drop_guard = maybe_drop_guard(
|
||||
tcx,
|
||||
self.typing_env,
|
||||
|
|
@ -1118,6 +1113,11 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> {
|
|||
continue;
|
||||
};
|
||||
|
||||
// By convention, underscore-prefixed bindings are allowed to be unused explicitly
|
||||
if name.as_str().starts_with('_') {
|
||||
break;
|
||||
}
|
||||
|
||||
match kind {
|
||||
AccessKind::Assign => {
|
||||
let suggestion = annotate_mut_binding_to_immutable_binding(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue