]> git.lizzy.rs Git - rust.git/commitdiff
Fixed all unnecessary muts in language core
authorIsaac van Bakel <ivb@vanbakel.io>
Tue, 1 Aug 2017 12:03:03 +0000 (13:03 +0100)
committerIsaac van Bakel <ivb@vanbakel.io>
Tue, 1 Aug 2017 22:01:24 +0000 (23:01 +0100)
32 files changed:
src/liballoc/btree/node.rs
src/liballoc/vec.rs
src/liballoc/vec_deque.rs
src/libcore/ops/function.rs
src/libcore/option.rs
src/libcore/result.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/traits/mod.rs
src/librustc/traits/select.rs
src/librustc/ty/inhabitedness/mod.rs
src/librustc_allocator/expand.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_data_structures/array_vec.rs
src/librustc_data_structures/bitvec.rs
src/librustc_data_structures/indexed_vec.rs
src/librustc_driver/lib.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_mir/build/matches/mod.rs
src/librustc_mir/transform/type_check.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_trans/base.rs
src/librustc_trans/partitioning.rs
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/libstd/collections/hash/map.rs
src/libstd/sync/once.rs
src/libstd/sys/unix/rand.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs

index 06d3a113b947471989ad7a803cb77e490f9f5038..8cea6c482c33d0a65c7a146f43dfd21fc3098d98 100644 (file)
@@ -1037,7 +1037,7 @@ impl<'a, K: 'a, V: 'a, NodeType>
         Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
 
     pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) {
-        let (mut keys, mut vals) = self.node.into_slices_mut();
+        let (keys, vals) = self.node.into_slices_mut();
         unsafe {
             (keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
         }
@@ -1047,7 +1047,7 @@ pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) {
 impl<'a, K, V, NodeType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
     pub fn kv_mut(&mut self) -> (&mut K, &mut V) {
         unsafe {
-            let (mut keys, mut vals) = self.node.reborrow_mut().into_slices_mut();
+            let (keys, vals) = self.node.reborrow_mut().into_slices_mut();
             (keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
         }
     }
index da47ca509832b95e5f9236f28e033def89ee930a..160c0ba2ab0e3482f56771f1950a73a3d107bc71 100644 (file)
@@ -1751,7 +1751,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
     type Item = &'a mut T;
     type IntoIter = slice::IterMut<'a, T>;
 
-    fn into_iter(mut self) -> slice::IterMut<'a, T> {
+    fn into_iter(self) -> slice::IterMut<'a, T> {
         self.iter_mut()
     }
 }
index fdd6c79ef2e9d74d8971033c588b7d0236cf76aa..055c2d4840a4247dfb602da265539aab2c0c32d9 100644 (file)
@@ -2394,7 +2394,7 @@ impl<'a, T> IntoIterator for &'a mut VecDeque<T> {
     type Item = &'a mut T;
     type IntoIter = IterMut<'a, T>;
 
-    fn into_iter(mut self) -> IterMut<'a, T> {
+    fn into_iter(self) -> IterMut<'a, T> {
         self.iter_mut()
     }
 }
index 62bf69336a398ebdb6015319562fac3ccbb19f46..c5b3fbca1a6dd492e313c6782cd44b2a2e43fa2c 100644 (file)
@@ -187,7 +187,7 @@ impl<'a,A,F:?Sized> FnOnce<A> for &'a mut F
         where F : FnMut<A>
     {
         type Output = F::Output;
-        extern "rust-call" fn call_once(mut self, args: A) -> F::Output {
+        extern "rust-call" fn call_once(self, args: A) -> F::Output {
             (*self).call_mut(args)
         }
     }
index ef41b6794105d8b62aacf75357f51d0dce320560..aecf2ee9325eee9dde0a13cef3d65e293610c147 100644 (file)
@@ -872,7 +872,7 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
     type Item = &'a mut T;
     type IntoIter = IterMut<'a, T>;
 
-    fn into_iter(mut self) -> IterMut<'a, T> {
+    fn into_iter(self) -> IterMut<'a, T> {
         self.iter_mut()
     }
 }
index 88a93492de96257276348c3f1eda3a28f6d2ff01..20cfb02afcc7707149236dd940066532ccc151c2 100644 (file)
@@ -909,7 +909,7 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
     type Item = &'a mut T;
     type IntoIter = IterMut<'a, T>;
 
-    fn into_iter(mut self) -> IterMut<'a, T> {
+    fn into_iter(self) -> IterMut<'a, T> {
         self.iter_mut()
     }
 }
index 8e8576b83e4ed4d238638768cbe61d012d928b0b..9f70b4834ddc5d71b0700be42671d9e584a3678f 100644 (file)
@@ -415,8 +415,8 @@ fn note_error_origin(&self,
     /// -------- this type is the same as a type argument in the other type, not highlighted
     /// ```
     fn highlight_outer(&self,
-                       mut value: &mut DiagnosticStyledString,
-                       mut other_value: &mut DiagnosticStyledString,
+                       value: &mut DiagnosticStyledString,
+                       other_value: &mut DiagnosticStyledString,
                        name: String,
                        sub: &ty::subst::Substs<'tcx>,
                        pos: usize,
index e14203b34a18072015a084ab97186a503cb4f593..d1938197e652965dbf338ac1c233141f36c9e909 100644 (file)
@@ -560,7 +560,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
 {
     debug!("fully_normalize(value={:?})", value);
 
-    let mut selcx = &mut SelectionContext::new(infcx);
+    let selcx = &mut SelectionContext::new(infcx);
     // FIXME (@jroesch) ISSUE 26721
     // I'm not sure if this is a bug or not, needs further investigation.
     // It appears that by reusing the fulfillment_cx here we incur more
index c690bebed8c00f09404b1780fd688d53b62b6425..2966e6715b404212be6ca0dae31d24c840104a48 100644 (file)
@@ -494,7 +494,7 @@ pub fn select(&mut self, obligation: &TraitObligation<'tcx>)
             never_obligation.predicate = never_obligation.predicate.map_bound(|mut trait_pred| {
                 // Swap out () with ! so we can check if the trait is impld for !
                 {
-                    let mut trait_ref = &mut trait_pred.trait_ref;
+                    let trait_ref = &mut trait_pred.trait_ref;
                     let unit_substs = trait_ref.substs;
                     let mut never_substs = Vec::with_capacity(unit_substs.len());
                     never_substs.push(From::from(tcx.types.never));
index 77c863a012318ca161a1ebbdf6f46a6a6839a3e0..900197f3dbd17c0756ebcf3c410e921270924ff0 100644 (file)
@@ -171,7 +171,7 @@ fn uninhabited_from_inner(
         match self.sty {
             TyAdt(def, substs) => {
                 {
-                    let mut substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
+                    let substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
                     if !substs_set.insert(substs) {
                         // We are already calculating the inhabitedness of this type.
                         // The type must contain a reference to itself. Break the
@@ -193,7 +193,7 @@ fn uninhabited_from_inner(
                     }
                 }
                 let ret = def.uninhabited_from(visited, tcx, substs);
-                let mut substs_set = visited.get_mut(&def.did).unwrap();
+                let substs_set = visited.get_mut(&def.did).unwrap();
                 substs_set.remove(substs);
                 ret
             },
index e942b7264c589ebf952988f4be92fd6cee29e2d5..676c3c51ea2a3d3aca2d09ec8599c32e48c1a646 100644 (file)
@@ -188,7 +188,7 @@ fn attrs(&self) -> Vec<Attribute> {
     fn arg_ty(&self,
               ty: &AllocatorTy,
               args: &mut Vec<Arg>,
-              mut ident: &mut FnMut() -> Ident) -> P<Expr> {
+              ident: &mut FnMut() -> Ident) -> P<Expr> {
         match *ty {
             AllocatorTy::Layout => {
                 let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
@@ -263,7 +263,7 @@ fn arg_ty(&self,
     fn ret_ty(&self,
               ty: &AllocatorTy,
               args: &mut Vec<Arg>,
-              mut ident: &mut FnMut() -> Ident,
+              ident: &mut FnMut() -> Ident,
               expr: P<Expr>) -> (P<Ty>, P<Expr>)
     {
         match *ty {
index 76c4ac57a149ee803312ac5690dee74050aa4f9f..6b31535c5a5260592066d33039388692fce50cd3 100644 (file)
@@ -98,7 +98,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) {
     let body_id = tcx.hir.body_owned_by(owner_id);
     let tables = tcx.typeck_tables_of(owner_def_id);
     let region_maps = tcx.region_maps(owner_def_id);
-    let mut bccx = &mut BorrowckCtxt { tcx, tables, region_maps, owner_def_id };
+    let bccx = &mut BorrowckCtxt { tcx, tables, region_maps, owner_def_id };
 
     let body = bccx.tcx.hir.body(body_id);
 
index ced73e9e4262767cd4f740200b8116b7ae876ccd..df660d08603adfa1cc2fb31a82d63299d1540902 100644 (file)
@@ -260,7 +260,7 @@ fn drop(&mut self) {
                 let start = source_array_vec.len();
                 let tail = self.tail_start;
                 {
-                    let mut arr = &mut source_array_vec.values as &mut [ManuallyDrop<_>];
+                    let arr = &mut source_array_vec.values as &mut [ManuallyDrop<_>];
                     let src = arr.as_ptr().offset(tail as isize);
                     let dst = arr.as_mut_ptr().offset(start as isize);
                     ptr::copy(src, dst, self.tail_len);
index ffcd25a4cdd39ab2863054812d614dfa7765cfd9..7fc59be780f6e565983e870d3cee6a09c186d21e 100644 (file)
@@ -166,7 +166,7 @@ fn range(&self, row: usize) -> (usize, usize) {
     pub fn add(&mut self, source: usize, target: usize) -> bool {
         let (start, _) = self.range(source);
         let (word, mask) = word_mask(target);
-        let mut vector = &mut self.vector[..];
+        let vector = &mut self.vector[..];
         let v1 = vector[start + word];
         let v2 = v1 | mask;
         vector[start + word] = v2;
index 29ac650aa7053110e374dfa6859919913b9cf067..1f44378c9e6466f590f1c06aec59f9ef39d3e9a0 100644 (file)
@@ -259,7 +259,7 @@ impl<'a, I: Idx, T> IntoIterator for &'a mut IndexVec<I, T> {
     type IntoIter = slice::IterMut<'a, T>;
 
     #[inline]
-    fn into_iter(mut self) -> slice::IterMut<'a, T> {
+    fn into_iter(self) -> slice::IterMut<'a, T> {
         self.raw.iter_mut()
     }
 }
index d6b1eb86937b065195a99b83492fc0495a618bd2..31f41b38060cdd74864c39de50361425d5f9deff 100644 (file)
@@ -422,7 +422,7 @@ fn show_content_with_pager(content: &String) {
 
     match Command::new(pager_name).stdin(Stdio::piped()).spawn() {
         Ok(mut pager) => {
-            if let Some(mut pipe) = pager.stdin.as_mut() {
+            if let Some(pipe) = pager.stdin.as_mut() {
                 if pipe.write_all(content.as_bytes()).is_err() {
                     fallback_to_println = true;
                 }
index e8b0dea1e8ac0285d9dc9a0e99d4baf395a9a2c2..d2ab9b2fbced359c497376a5f550c7cce1de0389 100644 (file)
@@ -479,7 +479,7 @@ fn visible_parent_map<'a>(&'a self, sess: &Session) -> ::std::cell::Ref<'a, DefI
                 _ => {},
             }
 
-            let mut bfs_queue = &mut VecDeque::new();
+            let bfs_queue = &mut VecDeque::new();
             let mut add_child = |bfs_queue: &mut VecDeque<_>, child: def::Export, parent: DefId| {
                 let child = child.def.def_id();
 
index 54f285480ab5371506e6fb1d3a7b78fb35f6a5a3..c0b54ce2a84decf7947e90f58321115103895471 100644 (file)
@@ -206,7 +206,7 @@ pub fn schedule_drop_for_binding(&mut self, var: NodeId, span: Span) {
         self.schedule_drop(span, extent, &Lvalue::Local(local_id), var_ty);
     }
 
-    pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, mut f: &mut F)
+    pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, f: &mut F)
         where F: FnMut(&mut Self, Mutability, Name, NodeId, Span, Ty<'tcx>)
     {
         match *pattern.kind {
index 7e6fccf30192ce626dbc072efd9b4948bf41b747..eb4a017c17b13f53d60e72d0e80fa84f986b5766 100644 (file)
@@ -720,7 +720,7 @@ fn normalize<T>(&mut self, value: &T) -> T
                value,
                obligations);
 
-        let mut fulfill_cx = &mut self.fulfillment_cx;
+        let fulfill_cx = &mut self.fulfillment_cx;
         for obligation in obligations {
             fulfill_cx.register_predicate_obligation(self.infcx, obligation);
         }
index 64af24d92eecb5f47304e5048b12f22d827b0b02..3caa9ad34d30a62d34ec662f19db7f2662ab3bf7 100644 (file)
@@ -781,7 +781,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
             hir::ItemTrait(.., ref trait_item_refs) => {
                 self.check_item(item.id).generics().predicates();
                 for trait_item_ref in trait_item_refs {
-                    let mut check = self.check_item(trait_item_ref.id.node_id);
+                    let check = self.check_item(trait_item_ref.id.node_id);
                     check.generics().predicates();
                     if trait_item_ref.kind != hir::AssociatedItemKind::Type ||
                        trait_item_ref.defaultness.has_value() {
@@ -814,7 +814,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
             }
             hir::ItemImpl(.., ref trait_ref, _, ref impl_item_refs) => {
                 {
-                    let mut check = self.check_item(item.id);
+                    let check = self.check_item(item.id);
                     check.ty().generics().predicates();
                     if trait_ref.is_some() {
                         check.impl_trait_ref();
index 5e799b14f209c9071d06b043e8cbdfa1d1e4aa0f..41f1f5877d8caba9b9971d52dc659d7a10212f63 100644 (file)
@@ -379,7 +379,7 @@ fn update_resolution<T, F>(&mut self, module: Module<'a>, ident: Ident, ns: Name
         // Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
         // during which the resolution might end up getting re-defined via a glob cycle.
         let (binding, t) = {
-            let mut resolution = &mut *self.resolution(module, ident, ns).borrow_mut();
+            let resolution = &mut *self.resolution(module, ident, ns).borrow_mut();
             let old_binding = resolution.binding();
 
             let t = f(self, resolution);
index 14c73de64bc798f80e82768dac05c2f1956ea6fa..99a48c4221b32fbb25c5dc022e34dcec8cf954a7 100644 (file)
@@ -1465,7 +1465,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>(scx: &SharedCrateContext<'a
                 let mut output = i.to_string(scx.tcx());
                 output.push_str(" @@");
                 let mut empty = Vec::new();
-                let mut cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
+                let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
                 cgus.as_mut_slice().sort_by_key(|&(ref name, _)| name.clone());
                 cgus.dedup();
                 for &(ref cgu_name, (linkage, _)) in cgus.iter() {
index 904cfb2acd74130da68b3043ce97aad838de2d9e..3ea23be7712f8b511677c269bc05f189cde7c493 100644 (file)
@@ -348,7 +348,7 @@ fn place_root_translation_items<'a, 'tcx, I>(scx: &SharedCrateContext<'a, 'tcx>,
                 CodegenUnit::empty(codegen_unit_name.clone())
             };
 
-            let mut codegen_unit = codegen_units.entry(codegen_unit_name.clone())
+            let codegen_unit = codegen_units.entry(codegen_unit_name.clone())
                                                 .or_insert_with(make_codegen_unit);
 
             let (linkage, visibility) = match trans_item.explicit_linkage(tcx) {
index 968e893b9a00b422862e26713fcd6aabbbfb0767..9ee425dab8faf37a3c20ab20ec06b7d014ebe54c 100644 (file)
@@ -1204,7 +1204,7 @@ fn coerce_inner<'a>(&mut self,
                     }
                 }
 
-                if let Some(mut augment_error) = augment_error {
+                if let Some(augment_error) = augment_error {
                     augment_error(&mut db);
                 }
 
index dfc5cd00b6eabcef882caa746ef98bff2f92e25c..a398d12a5bfd3c76c6ceb10646b94e097407db22 100644 (file)
@@ -538,7 +538,7 @@ fn assemble_inherent_impl_probe(&mut self, impl_def_id: DefId) {
             // We can't use normalize_associated_types_in as it will pollute the
             // fcx's fulfillment context after this probe is over.
             let cause = traits::ObligationCause::misc(self.span, self.body_id);
-            let mut selcx = &mut traits::SelectionContext::new(self.fcx);
+            let selcx = &mut traits::SelectionContext::new(self.fcx);
             let traits::Normalized { value: xform_self_ty, obligations } =
                 traits::normalize(selcx, self.param_env, cause, &xform_self_ty);
             debug!("assemble_inherent_impl_probe: xform_self_ty = {:?}",
@@ -749,7 +749,7 @@ fn assemble_extension_candidates_for_trait_impls(&mut self,
             // as it will pollute the fcx's fulfillment context after this probe
             // is over.
             let cause = traits::ObligationCause::misc(self.span, self.body_id);
-            let mut selcx = &mut traits::SelectionContext::new(self.fcx);
+            let selcx = &mut traits::SelectionContext::new(self.fcx);
             let traits::Normalized { value: xform_self_ty, obligations } =
                 traits::normalize(selcx, self.param_env, cause, &xform_self_ty);
 
index 17aae7dc04f2ae0dbc295ddebb88d1c2ddac944c..197d5b86db875a07f1846ffe88c9865a6764a26b 100644 (file)
@@ -4147,8 +4147,8 @@ fn check_block_with_expected(&self,
             let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected));
 
             let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
-            let mut ctxt = enclosing_breakables.find_breakable(blk.id);
-            let mut coerce = ctxt.coerce.as_mut().unwrap();
+            let ctxt = enclosing_breakables.find_breakable(blk.id);
+            let coerce = ctxt.coerce.as_mut().unwrap();
             if let Some(tail_expr_ty) = tail_expr_ty {
                 let tail_expr = tail_expr.unwrap();
                 let cause = self.cause(tail_expr.span,
index 032e37a34a887f7acbfa478029100309b4d4ffc3..c1711491ee48ca2427d0dbfc4f49d3dee71d160b 100644 (file)
@@ -300,7 +300,7 @@ fn check_str_addition(&self,
                           lhs_expr: &'gcx hir::Expr,
                           lhs_ty: Ty<'tcx>,
                           rhs_ty: Ty<'tcx>,
-                          mut err: &mut errors::DiagnosticBuilder) -> bool {
+                          err: &mut errors::DiagnosticBuilder) -> bool {
         // If this function returns true it means a note was printed, so we don't need
         // to print the normal "implementation of `std::ops::Add` might be missing" note
         let mut is_string_addition = false;
index 12241b3f88187f17ba2c8653057c21faac58013e..7e2229a8f84a3bb014f169112c02eb40901c7e52 100644 (file)
@@ -1618,7 +1618,7 @@ impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
     type Item = (&'a K, &'a mut V);
     type IntoIter = IterMut<'a, K, V>;
 
-    fn into_iter(mut self) -> IterMut<'a, K, V> {
+    fn into_iter(self) -> IterMut<'a, K, V> {
         self.iter_mut()
     }
 }
index d9edf5d1254896c492fb5f9cc2009a77d528e76f..bb18fe95a9dbfb08cfee8456a364bc2b4f50b7c8 100644 (file)
@@ -267,7 +267,7 @@ pub fn call_once_force<F>(&'static self, f: F) where F: FnOnce(&OnceState) {
     #[cold]
     fn call_inner(&'static self,
                   ignore_poisoning: bool,
-                  mut init: &mut FnMut(bool)) {
+                  init: &mut FnMut(bool)) {
         let mut state = self.state.load(Ordering::SeqCst);
 
         'outer: loop {
index 77ebad4e344c24adbcef0ae199fee1c7a9c8168b..1f56a299407edb2fbbb20a41efbaaf4c7da2bcf7 100644 (file)
 
 use mem;
 
-fn next_u32(mut fill_buf: &mut FnMut(&mut [u8])) -> u32 {
+fn next_u32(fill_buf: &mut FnMut(&mut [u8])) -> u32 {
     let mut buf: [u8; 4] = [0; 4];
     fill_buf(&mut buf);
     unsafe { mem::transmute::<[u8; 4], u32>(buf) }
 }
 
-fn next_u64(mut fill_buf: &mut FnMut(&mut [u8])) -> u64 {
+fn next_u64(fill_buf: &mut FnMut(&mut [u8])) -> u64 {
     let mut buf: [u8; 8] = [0; 8];
     fill_buf(&mut buf);
     unsafe { mem::transmute::<[u8; 8], u64>(buf) }
index 60833c75a15961ceb525d5deb1813cc8bf0d49b2..146bd5d985699fead5fc4050eadc3f426752b4ca 100644 (file)
@@ -211,7 +211,7 @@ pub enum NamedMatch {
 
 fn nameize<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, ms: &[TokenTree], mut res: I)
                                              -> NamedParseResult {
-    fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, mut res: &mut I,
+    fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, res: &mut I,
              ret_val: &mut HashMap<Ident, Rc<NamedMatch>>)
              -> Result<(), (syntax_pos::Span, String)> {
         match *m {
@@ -445,7 +445,7 @@ pub fn parse(sess: &ParseSess,
         /* error messages here could be improved with links to orig. rules */
         if token_name_eq(&parser.token, &token::Eof) {
             if eof_items.len() == 1 {
-                let matches = eof_items[0].matches.iter_mut().map(|mut dv| {
+                let matches = eof_items[0].matches.iter_mut().map(|dv| {
                     Rc::make_mut(dv).pop().unwrap()
                 });
                 return nameize(sess, ms, matches);
index 8e746676ecd9e3f4fc14fbd26ca296d19c7bed7c..80b6794d1e3cc4c01aae143a8c5d89faef7f1455 100644 (file)
@@ -86,7 +86,7 @@ fn expand<'cx>(&self,
 
 fn trace_macros_note(cx: &mut ExtCtxt, sp: Span, message: String) {
     let sp = sp.macro_backtrace().last().map(|trace| trace.call_site).unwrap_or(sp);
-    let mut values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
+    let values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
     values.push(message);
 }