Skip to content

Commit 400075d

Browse files
committed
Fixed all unnecessary muts in language core
1 parent 35b9bd0 commit 400075d

File tree

32 files changed

+41
-41
lines changed

32 files changed

+41
-41
lines changed

src/liballoc/btree/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ impl<'a, K: 'a, V: 'a, NodeType>
10371037
Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
10381038

10391039
pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) {
1040-
let (mut keys, mut vals) = self.node.into_slices_mut();
1040+
let (keys, vals) = self.node.into_slices_mut();
10411041
unsafe {
10421042
(keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
10431043
}
@@ -1047,7 +1047,7 @@ impl<'a, K: 'a, V: 'a, NodeType>
10471047
impl<'a, K, V, NodeType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
10481048
pub fn kv_mut(&mut self) -> (&mut K, &mut V) {
10491049
unsafe {
1050-
let (mut keys, mut vals) = self.node.reborrow_mut().into_slices_mut();
1050+
let (keys, vals) = self.node.reborrow_mut().into_slices_mut();
10511051
(keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
10521052
}
10531053
}

src/liballoc/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
17511751
type Item = &'a mut T;
17521752
type IntoIter = slice::IterMut<'a, T>;
17531753

1754-
fn into_iter(mut self) -> slice::IterMut<'a, T> {
1754+
fn into_iter(self) -> slice::IterMut<'a, T> {
17551755
self.iter_mut()
17561756
}
17571757
}

src/liballoc/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@ impl<'a, T> IntoIterator for &'a mut VecDeque<T> {
23942394
type Item = &'a mut T;
23952395
type IntoIter = IterMut<'a, T>;
23962396

2397-
fn into_iter(mut self) -> IterMut<'a, T> {
2397+
fn into_iter(self) -> IterMut<'a, T> {
23982398
self.iter_mut()
23992399
}
24002400
}

src/libcore/ops/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ mod impls {
187187
where F : FnMut<A>
188188
{
189189
type Output = F::Output;
190-
extern "rust-call" fn call_once(mut self, args: A) -> F::Output {
190+
extern "rust-call" fn call_once(self, args: A) -> F::Output {
191191
(*self).call_mut(args)
192192
}
193193
}

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
872872
type Item = &'a mut T;
873873
type IntoIter = IterMut<'a, T>;
874874

875-
fn into_iter(mut self) -> IterMut<'a, T> {
875+
fn into_iter(self) -> IterMut<'a, T> {
876876
self.iter_mut()
877877
}
878878
}

src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
909909
type Item = &'a mut T;
910910
type IntoIter = IterMut<'a, T>;
911911

912-
fn into_iter(mut self) -> IterMut<'a, T> {
912+
fn into_iter(self) -> IterMut<'a, T> {
913913
self.iter_mut()
914914
}
915915
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
415415
/// -------- this type is the same as a type argument in the other type, not highlighted
416416
/// ```
417417
fn highlight_outer(&self,
418-
mut value: &mut DiagnosticStyledString,
419-
mut other_value: &mut DiagnosticStyledString,
418+
value: &mut DiagnosticStyledString,
419+
other_value: &mut DiagnosticStyledString,
420420
name: String,
421421
sub: &ty::subst::Substs<'tcx>,
422422
pos: usize,

src/librustc/traits/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
560560
{
561561
debug!("fully_normalize(value={:?})", value);
562562

563-
let mut selcx = &mut SelectionContext::new(infcx);
563+
let selcx = &mut SelectionContext::new(infcx);
564564
// FIXME (@jroesch) ISSUE 26721
565565
// I'm not sure if this is a bug or not, needs further investigation.
566566
// It appears that by reusing the fulfillment_cx here we incur more

src/librustc/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
494494
never_obligation.predicate = never_obligation.predicate.map_bound(|mut trait_pred| {
495495
// Swap out () with ! so we can check if the trait is impld for !
496496
{
497-
let mut trait_ref = &mut trait_pred.trait_ref;
497+
let trait_ref = &mut trait_pred.trait_ref;
498498
let unit_substs = trait_ref.substs;
499499
let mut never_substs = Vec::with_capacity(unit_substs.len());
500500
never_substs.push(From::from(tcx.types.never));

src/librustc/ty/inhabitedness/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
171171
match self.sty {
172172
TyAdt(def, substs) => {
173173
{
174-
let mut substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
174+
let substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
175175
if !substs_set.insert(substs) {
176176
// We are already calculating the inhabitedness of this type.
177177
// The type must contain a reference to itself. Break the
@@ -193,7 +193,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
193193
}
194194
}
195195
let ret = def.uninhabited_from(visited, tcx, substs);
196-
let mut substs_set = visited.get_mut(&def.did).unwrap();
196+
let substs_set = visited.get_mut(&def.did).unwrap();
197197
substs_set.remove(substs);
198198
ret
199199
},

0 commit comments

Comments
 (0)