about summary refs log tree commit diff
path: root/compiler/rustc_save_analysis/src
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2022-08-30 17:34:35 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2022-09-02 12:55:05 -0500
commit02ba216e3cb6edd4a51e0738953a4276aa84fa20 (patch)
treec95feda408690266979d174e2511515d15805785 /compiler/rustc_save_analysis/src
parent9353538c7bea6edb245457712cec720305c4576e (diff)
downloadrust-02ba216e3cb6edd4a51e0738953a4276aa84fa20.tar.gz
rust-02ba216e3cb6edd4a51e0738953a4276aa84fa20.zip
Refactor and re-use BindingAnnotation
Diffstat (limited to 'compiler/rustc_save_analysis/src')
-rw-r--r--compiler/rustc_save_analysis/src/lib.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs
index 16af5338510..eae1f083107 100644
--- a/compiler/rustc_save_analysis/src/lib.rs
+++ b/compiler/rustc_save_analysis/src/lib.rs
@@ -865,23 +865,12 @@ impl<'l> Visitor<'l> for PathCollector<'l> {
             hir::PatKind::TupleStruct(ref path, ..) | hir::PatKind::Path(ref path) => {
                 self.collected_paths.push((p.hir_id, path));
             }
-            hir::PatKind::Binding(bm, _, ident, _) => {
+            hir::PatKind::Binding(hir::BindingAnnotation(_, mutbl), _, ident, _) => {
                 debug!(
                     "PathCollector, visit ident in pat {}: {:?} {:?}",
                     ident, p.span, ident.span
                 );
-                let immut = match bm {
-                    // Even if the ref is mut, you can't change the ref, only
-                    // the data pointed at, so showing the initialising expression
-                    // is still worthwhile.
-                    hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Ref => {
-                        hir::Mutability::Not
-                    }
-                    hir::BindingAnnotation::Mutable | hir::BindingAnnotation::RefMut => {
-                        hir::Mutability::Mut
-                    }
-                };
-                self.collected_idents.push((p.hir_id, ident, immut));
+                self.collected_idents.push((p.hir_id, ident, mutbl));
             }
             _ => {}
         }