remove unused mut qualifiers

This commit is contained in:
Jorge Aparicio 2015-01-31 09:17:50 -05:00
parent fd702702ee
commit 3484706c38
36 changed files with 40 additions and 53 deletions

View File

@ -673,7 +673,7 @@ impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Extend<T> for BinaryHeap<T> {
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=T>>(&mut self, iter: Iter) {
let (lower, _) = iter.size_hint();
self.reserve(lower);

View File

@ -934,7 +934,7 @@ impl FromIterator<bool> for Bitv {
#[stable(feature = "rust1", since = "1.0.0")]
impl Extend<bool> for Bitv {
#[inline]
fn extend<I: Iterator<Item=bool>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=bool>>(&mut self, iterator: I) {
let (min, _) = iterator.size_hint();
self.reserve(min);
for element in iterator {
@ -1141,7 +1141,7 @@ impl FromIterator<uint> for BitvSet {
#[stable(feature = "rust1", since = "1.0.0")]
impl Extend<uint> for BitvSet {
#[inline]
fn extend<I: Iterator<Item=uint>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=uint>>(&mut self, iterator: I) {
for i in iterator {
self.insert(i);
}
@ -1353,7 +1353,7 @@ impl BitvSet {
}
// virtually pad other with 0's for equal lengths
let mut other_words = {
let other_words = {
let (_, result) = match_words(self_bitv, other_bitv);
result
};

View File

@ -846,7 +846,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
#[inline]
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
fn extend<T: Iterator<Item=(K, V)>>(&mut self, iter: T) {
for (k, v) in iter {
self.insert(k, v);
}

View File

@ -499,7 +499,7 @@ impl<'a, T> IntoIterator for &'a BTreeSet<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> Extend<T> for BTreeSet<T> {
#[inline]
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=T>>(&mut self, iter: Iter) {
for elem in iter {
self.insert(elem);
}

View File

@ -856,7 +856,7 @@ impl<'a, T> IntoIterator for &'a mut DList<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<A> Extend<A> for DList<A> {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T) {
for elt in iterator { self.push_back(elt); }
}
}

View File

@ -266,7 +266,7 @@ impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
}
impl<E:CLike> Extend<E> for EnumSet<E> {
fn extend<I: Iterator<Item=E>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=E>>(&mut self, iterator: I) {
for element in iterator {
self.insert(element);
}

View File

@ -22,8 +22,6 @@
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(alloc)]
#![feature(box_syntax)]
#![feature(core)]

View File

@ -1635,7 +1635,7 @@ impl<'a, T> IntoIterator for &'a mut RingBuf<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<A> Extend<A> for RingBuf<A> {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T) {
for elt in iterator {
self.push_back(elt);
}

View File

@ -729,7 +729,7 @@ impl<'a> FromIterator<&'a str> for String {
#[unstable(feature = "collections",
reason = "waiting on Extend stabilization")]
impl Extend<char> for String {
fn extend<I:Iterator<Item=char>>(&mut self, mut iterator: I) {
fn extend<I:Iterator<Item=char>>(&mut self, iterator: I) {
let (lower_bound, _) = iterator.size_hint();
self.reserve(lower_bound);
for ch in iterator {
@ -741,7 +741,7 @@ impl Extend<char> for String {
#[unstable(feature = "collections",
reason = "waiting on Extend stabilization")]
impl<'a> Extend<&'a str> for String {
fn extend<I: Iterator<Item=&'a str>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=&'a str>>(&mut self, iterator: I) {
// A guess that at least one byte per iterator element will be needed.
let (lower_bound, _) = iterator.size_hint();
self.reserve(lower_bound);

View File

@ -1375,7 +1375,7 @@ impl<T> ops::DerefMut for Vec<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> FromIterator<T> for Vec<T> {
#[inline]
fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> {
fn from_iter<I:Iterator<Item=T>>(iterator: I) -> Vec<T> {
let (lower, _) = iterator.size_hint();
let mut vector = Vec::with_capacity(lower);
for element in iterator {
@ -1412,7 +1412,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
#[unstable(feature = "collections", reason = "waiting on Extend stability")]
impl<T> Extend<T> for Vec<T> {
#[inline]
fn extend<I: Iterator<Item=T>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=T>>(&mut self, iterator: I) {
let (lower, _) = iterator.size_hint();
self.reserve(lower);
for element in iterator {

View File

@ -562,7 +562,7 @@ impl<'a, T> IntoIterator for &'a mut VecMap<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<V> Extend<(uint, V)> for VecMap<V> {
fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, iter: Iter) {
for (k, v) in iter {
self.insert(k, v);
}

View File

@ -174,7 +174,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn last(mut self) -> Option<Self::Item> {
fn last(self) -> Option<Self::Item> {
let mut last = None;
for x in self { last = Some(x); }
last
@ -588,7 +588,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[unstable(feature = "core",
reason = "recently added as part of collections reform")]
fn partition<B, F>(mut self, mut f: F) -> (B, B) where
fn partition<B, F>(self, mut f: F) -> (B, B) where
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool
{
@ -617,7 +617,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(mut self, init: B, mut f: F) -> B where
fn fold<B, F>(self, init: B, mut f: F) -> B where
F: FnMut(B, Self::Item) -> B,
{
let mut accum = init;
@ -638,7 +638,7 @@ pub trait IteratorExt: Iterator + Sized {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
fn all<F>(self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
for x in self { if !f(x) { return false; } }
true
}
@ -946,7 +946,7 @@ pub trait IteratorExt: Iterator + Sized {
/// assert_eq!([2, 4], right);
/// ```
#[unstable(feature = "core", reason = "recent addition")]
fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Iterator<Item=(A, B)>,

View File

@ -59,7 +59,6 @@
#![no_std]
#![allow(raw_pointer_derive)]
#![deny(missing_docs)]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(int_uint)]
#![feature(intrinsics, lang_items)]

View File

@ -956,7 +956,7 @@ pub fn fold<T,
E,
F: FnMut(V, T) -> V,
Iter: Iterator<Item=Result<T, E>>>(
mut iterator: Iter,
iterator: Iter,
mut init: V,
mut f: F)
-> Result<V, E> {

View File

@ -23,8 +23,6 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]

View File

@ -610,7 +610,7 @@ impl<'a> Context<'a> {
let mut rlibs = HashMap::new();
let mut dylibs = HashMap::new();
{
let mut locs = locs.iter().map(|l| Path::new(&l[])).filter(|loc| {
let locs = locs.iter().map(|l| Path::new(&l[])).filter(|loc| {
if !loc.exists() {
sess.err(&format!("extern location for {} does not exist: {}",
self.crate_name, loc.display())[]);

View File

@ -317,7 +317,7 @@ impl<T> VecPerParamSpace<T> {
///
/// Unlike the `extend` method in `Vec`, this should not be assumed
/// to be a cheap operation (even when amortized over many calls).
pub fn extend<I:Iterator<Item=T>>(&mut self, space: ParamSpace, mut values: I) {
pub fn extend<I:Iterator<Item=T>>(&mut self, space: ParamSpace, values: I) {
// This could be made more efficient, obviously.
for item in values {
self.push(space, item);

View File

@ -295,7 +295,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
fn evaluate_predicates_recursively<'a,'o,I>(&mut self,
stack: Option<&TraitObligationStack<'o, 'tcx>>,
mut predicates: I)
predicates: I)
-> EvaluationResult<'tcx>
where I : Iterator<Item=&'a PredicateObligation<'tcx>>, 'tcx:'a
{

View File

@ -265,7 +265,7 @@ pub fn sanitize(s: &str) -> String {
return result;
}
pub fn mangle<PI: Iterator<Item=PathElem>>(mut path: PI,
pub fn mangle<PI: Iterator<Item=PathElem>>(path: PI,
hash: Option<&str>) -> String {
// Follow C++ namespace-mangling style, see
// http://en.wikipedia.org/wiki/Name_mangling for more info.
@ -1055,10 +1055,10 @@ fn add_local_native_libraries(cmd: &mut Command, sess: &Session) {
let libs = sess.cstore.get_used_libraries();
let libs = libs.borrow();
let mut staticlibs = libs.iter().filter_map(|&(ref l, kind)| {
let staticlibs = libs.iter().filter_map(|&(ref l, kind)| {
if kind == cstore::NativeStatic {Some(l)} else {None}
});
let mut others = libs.iter().filter(|&&(_, kind)| {
let others = libs.iter().filter(|&&(_, kind)| {
kind != cstore::NativeStatic
});

View File

@ -23,8 +23,6 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(alloc)]
#![feature(box_syntax)]
#![feature(collections)]

View File

@ -3848,7 +3848,7 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
def_id: ast::DefId,
qualified: bool,
output: &mut String) {
ty::with_path(cx.tcx(), def_id, |mut path| {
ty::with_path(cx.tcx(), def_id, |path| {
if qualified {
if def_id.krate == ast::LOCAL_CRATE {
output.push_str(crate_root_namespace(cx));

View File

@ -353,7 +353,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
assert!(ty_substs_a.len() == ty_substs_b.len());
let mut result = None;
let mut tps = ty_substs_a.iter().zip(ty_substs_b.iter()).enumerate();
let tps = ty_substs_a.iter().zip(ty_substs_b.iter()).enumerate();
for (i, (tp_a, tp_b)) in tps {
if self.fcx.infcx().try(|_| self.subtype(*tp_a, *tp_b)).is_ok() {
continue;

View File

@ -805,7 +805,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
a.check_name("rustc_on_unimplemented")
}) {
if let Some(ref istring) = attr.value_str() {
let mut parser = Parser::new(istring.get());
let parser = Parser::new(istring.get());
let types = generics.ty_params.as_slice();
for token in parser {
match token {

View File

@ -854,7 +854,7 @@ fn constrain_callee(rcx: &mut Rcx,
fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
call_expr: &ast::Expr,
receiver: Option<&ast::Expr>,
mut arg_exprs: I,
arg_exprs: I,
implicitly_ref_args: bool) {
//! Invoked on every call site (i.e., normal calls, method calls,
//! and overloaded operators). Constrains the regions which appear

View File

@ -439,7 +439,7 @@ fn convert_associated_type<'a, 'tcx>(ccx: &CollectCtxt<'a, 'tcx>,
fn convert_methods<'a,'tcx,'i,I>(ccx: &CollectCtxt<'a, 'tcx>,
container: ImplOrTraitItemContainer,
mut ms: I,
ms: I,
untransformed_rcvr_ty: Ty<'tcx>,
rcvr_ty_generics: &ty::Generics<'tcx>,
rcvr_visibility: ast::Visibility)
@ -1655,7 +1655,7 @@ fn enforce_impl_ty_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
loop {
let num_inputs = input_parameters.len();
let mut projection_predicates =
let projection_predicates =
impl_scheme.generics.predicates
.iter()
.filter_map(|predicate| {

View File

@ -73,7 +73,6 @@ This API is completely unstable and subject to change.
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![allow(non_camel_case_types)]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(box_syntax)]
#![feature(collections)]

View File

@ -1416,7 +1416,7 @@ impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
{
type Iter = IntoIter<K, V>;
fn into_iter(mut self) -> IntoIter<K, V> {
fn into_iter(self) -> IntoIter<K, V> {
self.into_iter()
}
}
@ -1575,7 +1575,7 @@ impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
fn extend<T: Iterator<Item=(K, V)>>(&mut self, iter: T) {
for (k, v) in iter {
self.insert(k, v);
}

View File

@ -636,7 +636,7 @@ impl<T, S, H> Extend<T> for HashSet<T, S>
S: HashState<Hasher=H>,
H: hash::Hasher<Output=u64>
{
fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) {
fn extend<I: Iterator<Item=T>>(&mut self, iter: I) {
for k in iter {
self.insert(k);
}

View File

@ -127,7 +127,6 @@
#![no_std]
#![deny(missing_docs)]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#[cfg(test)]
#[macro_use]

View File

@ -597,7 +597,7 @@ pub fn mkdir_recursive(path: &Path, mode: FilePermission) -> IoResult<()> {
return Ok(())
}
let mut comps = path.components();
let comps = path.components();
let mut curpath = path.root_path().unwrap_or(Path::new("."));
for c in comps {

View File

@ -366,7 +366,7 @@ impl FromIterator<CodePoint> for Wtf8Buf {
/// This replaces surrogate code point pairs with supplementary code points,
/// like concatenating ill-formed UTF-16 strings effectively would.
impl Extend<CodePoint> for Wtf8Buf {
fn extend<T: Iterator<Item=CodePoint>>(&mut self, mut iterator: T) {
fn extend<T: Iterator<Item=CodePoint>>(&mut self, iterator: T) {
let (low, _high) = iterator.size_hint();
// Lower bound of one byte per code point (ASCII only)
self.bytes.reserve(low);

View File

@ -373,7 +373,7 @@ impl fmt::Display for StabilityLevel {
fn find_stability_generic<'a,
AM: AttrMetaMethods,
I: Iterator<Item=&'a AM>>
(diagnostic: &SpanHandler, mut attrs: I, item_sp: Span)
(diagnostic: &SpanHandler, attrs: I, item_sp: Span)
-> (Option<Stability>, Vec<&'a AM>) {
let mut stab: Option<Stability> = None;

View File

@ -23,8 +23,6 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]

View File

@ -38,7 +38,7 @@ impl<T> FromIterator<T> for SmallVector<T> {
}
impl<T> Extend<T> for SmallVector<T> {
fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) {
fn extend<I: Iterator<Item=T>>(&mut self, iter: I) {
for val in iter {
self.push(val);
}

View File

@ -32,8 +32,6 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap
#![feature(asm, slicing_syntax)]
#![feature(box_syntax)]
#![feature(collections)]

View File

@ -332,7 +332,7 @@ pub fn winsorize<T: Float + FromPrimitive>(samples: &mut [T], pct: T) {
/// Returns a HashMap with the number of occurrences of every element in the
/// sequence that the iterator exposes.
pub fn freq_count<T, U>(mut iter: T) -> hash_map::HashMap<U, uint>
pub fn freq_count<T, U>(iter: T) -> hash_map::HashMap<U, uint>
where T: Iterator<Item=U>, U: Eq + Clone + Hash<Hasher>
{
let mut map: hash_map::HashMap<U,uint> = hash_map::HashMap::new();