diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 07e92c704d86f..a5512b3042436 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -359,7 +359,7 @@ pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::Test let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths let testfile = testfile.as_str().unwrap().to_string(); - test::DynMetricFn(box move |: mm: &mut test::MetricMap| { + test::DynMetricFn(box move |mm: &mut test::MetricMap| { runtest::run_metrics(config, testfile, mm) }) } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 75f7b812974d7..396b14f564fc2 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -199,7 +199,7 @@ impl<'a> Iterator for Decompositions<'a> { let buffer = &mut self.buffer; let sorted = &mut self.sorted; { - let callback = |&mut: d| { + let callback = |d| { let class = unicode::char::canonical_combining_class(d); if class == 0 && !*sorted { @@ -592,7 +592,7 @@ pub trait StrExt: Index { /// let v: Vec<&str> = "Mary had a little lamb".split(' ').collect(); /// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]); /// - /// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).collect(); + /// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).collect(); /// assert_eq!(v, vec!["abc", "def", "ghi"]); /// /// let v: Vec<&str> = "lionXXtigerXleopard".split('X').collect(); @@ -616,7 +616,7 @@ pub trait StrExt: Index { /// let v: Vec<&str> = "Mary had a little lambda".splitn(2, ' ').collect(); /// assert_eq!(v, vec!["Mary", "had", "a little lambda"]); /// - /// let v: Vec<&str> = "abc1def2ghi".splitn(1, |&: c: char| c.is_numeric()).collect(); + /// let v: Vec<&str> = "abc1def2ghi".splitn(1, |c: char| c.is_numeric()).collect(); /// assert_eq!(v, vec!["abc", "def2ghi"]); /// /// let v: Vec<&str> = "lionXXtigerXleopard".splitn(2, 'X').collect(); @@ -651,7 +651,7 @@ pub trait StrExt: Index { /// let v: Vec<&str> = "Mary had a little lamb".split(' ').rev().collect(); /// assert_eq!(v, vec!["lamb", "little", "a", "had", "Mary"]); /// - /// let v: Vec<&str> = "abc1def2ghi".split(|&: c: char| c.is_numeric()).rev().collect(); + /// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).rev().collect(); /// assert_eq!(v, vec!["ghi", "def", "abc"]); /// /// let v: Vec<&str> = "lionXXtigerXleopard".split('X').rev().collect(); @@ -672,7 +672,7 @@ pub trait StrExt: Index { /// let v: Vec<&str> = "Mary had a little lamb".rsplitn(2, ' ').collect(); /// assert_eq!(v, vec!["lamb", "little", "Mary had a"]); /// - /// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |&: c: char| c.is_numeric()).collect(); + /// let v: Vec<&str> = "abc1def2ghi".rsplitn(1, |c: char| c.is_numeric()).collect(); /// assert_eq!(v, vec!["ghi", "abc1def"]); /// /// let v: Vec<&str> = "lionXXtigerXleopard".rsplitn(2, 'X').collect(); @@ -853,7 +853,7 @@ pub trait StrExt: Index { /// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar"); /// let x: &[_] = &['1', '2']; /// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar"); - /// assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar"); + /// assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn trim_matches(&self, pat: P) -> &str { @@ -873,7 +873,7 @@ pub trait StrExt: Index { /// assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11"); /// let x: &[_] = &['1', '2']; /// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12"); - /// assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123"); + /// assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn trim_left_matches(&self, pat: P) -> &str { @@ -893,7 +893,7 @@ pub trait StrExt: Index { /// assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar"); /// let x: &[_] = &['1', '2']; /// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar"); - /// assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar"); + /// assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn trim_right_matches(&self, pat: P) -> &str { @@ -1066,7 +1066,7 @@ pub trait StrExt: Index { /// assert_eq!(s.find('é'), Some(14)); /// /// // the first space - /// assert_eq!(s.find(|&: c: char| c.is_whitespace()), Some(5)); + /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5)); /// /// // neither are found /// let x: &[_] = &['1', '2']; @@ -1094,7 +1094,7 @@ pub trait StrExt: Index { /// assert_eq!(s.rfind('é'), Some(14)); /// /// // the second space - /// assert_eq!(s.rfind(|&: c: char| c.is_whitespace()), Some(12)); + /// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12)); /// /// // searches for an occurrence of either `1` or `2`, but neither are found /// let x: &[_] = &['1', '2']; @@ -1387,21 +1387,21 @@ mod tests { #[test] fn test_find() { assert_eq!("hello".find('l'), Some(2u)); - assert_eq!("hello".find(|&: c:char| c == 'o'), Some(4u)); + assert_eq!("hello".find(|c:char| c == 'o'), Some(4u)); assert!("hello".find('x').is_none()); - assert!("hello".find(|&: c:char| c == 'x').is_none()); + assert!("hello".find(|c:char| c == 'x').is_none()); assert_eq!("ประเทศไทย中华Việt Nam".find('华'), Some(30u)); - assert_eq!("ประเทศไทย中华Việt Nam".find(|&: c: char| c == '华'), Some(30u)); + assert_eq!("ประเทศไทย中华Việt Nam".find(|c: char| c == '华'), Some(30u)); } #[test] fn test_rfind() { assert_eq!("hello".rfind('l'), Some(3u)); - assert_eq!("hello".rfind(|&: c:char| c == 'o'), Some(4u)); + assert_eq!("hello".rfind(|c:char| c == 'o'), Some(4u)); assert!("hello".rfind('x').is_none()); - assert!("hello".rfind(|&: c:char| c == 'x').is_none()); + assert!("hello".rfind(|c:char| c == 'x').is_none()); assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30u)); - assert_eq!("ประเทศไทย中华Việt Nam".rfind(|&: c: char| c == '华'), Some(30u)); + assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30u)); } #[test] @@ -1723,7 +1723,7 @@ mod tests { assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11"); let chars: &[char] = &['1', '2']; assert_eq!("12foo1bar12".trim_left_matches(chars), "foo1bar12"); - assert_eq!("123foo1bar123".trim_left_matches(|&: c: char| c.is_numeric()), "foo1bar123"); + assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123"); } #[test] @@ -1738,7 +1738,7 @@ mod tests { assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar"); let chars: &[char] = &['1', '2']; assert_eq!("12foo1bar12".trim_right_matches(chars), "12foo1bar"); - assert_eq!("123foo1bar123".trim_right_matches(|&: c: char| c.is_numeric()), "123foo1bar"); + assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar"); } #[test] @@ -1753,7 +1753,7 @@ mod tests { assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar"); let chars: &[char] = &['1', '2']; assert_eq!("12foo1bar12".trim_matches(chars), "foo1bar"); - assert_eq!("123foo1bar123".trim_matches(|&: c: char| c.is_numeric()), "foo1bar"); + assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar"); } #[test] @@ -2222,14 +2222,14 @@ mod tests { let split: Vec<&str> = data.splitn(3, ' ').collect(); assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]); - let split: Vec<&str> = data.splitn(3, |&: c: char| c == ' ').collect(); + let split: Vec<&str> = data.splitn(3, |c: char| c == ' ').collect(); assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]); // Unicode let split: Vec<&str> = data.splitn(3, 'ä').collect(); assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]); - let split: Vec<&str> = data.splitn(3, |&: c: char| c == 'ä').collect(); + let split: Vec<&str> = data.splitn(3, |c: char| c == 'ä').collect(); assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]); } @@ -2940,7 +2940,7 @@ mod bench { let s = "Mary had a little lamb, Little lamb, little-lamb."; let len = s.split(' ').count(); - b.iter(|| assert_eq!(s.split(|&: c: char| c == ' ').count(), len)); + b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len)); } #[bench] diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index 0f444ef186f9a..182851002d942 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -23,7 +23,7 @@ //! //! use std::finally::Finally; //! -//! (|&mut:| { +//! (|| { //! // ... //! }).finally(|| { //! // this code is always run diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 0963afaf72e21..25bb959b9b3aa 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -225,10 +225,10 @@ pub fn float_to_str_bytes_common( // cut off the one extra digit, and depending on its value // round the remaining ones. if limit_digits && dig == digit_count { - let ascii2value = |&: chr: u8| { + let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |&: val: uint| { + let value2ascii = |val: uint| { char::from_digit(val, radix).unwrap() as u8 }; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 60262857765e2..0357b723b3c7a 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -483,7 +483,7 @@ impl<'a> Formatter<'a> { } // Writes the sign if it exists, and then the prefix if it was requested - let write_prefix = |&: f: &mut Formatter| { + let write_prefix = |f: &mut Formatter| { if let Some(c) = sign { let mut b = [0; 4]; let n = c.encode_utf8(&mut b).unwrap_or(0); diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8c0c16bafc4c5..673ab1e094a86 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1518,11 +1518,11 @@ impl StrExt for str { #[inline] fn trim_matches(&self, mut pat: P) -> &str { - let cur = match self.find(|&mut: c: char| !pat.matches(c)) { + let cur = match self.find(|c: char| !pat.matches(c)) { None => "", Some(i) => unsafe { self.slice_unchecked(i, self.len()) } }; - match cur.rfind(|&mut: c: char| !pat.matches(c)) { + match cur.rfind(|c: char| !pat.matches(c)) { None => "", Some(i) => { let right = cur.char_range_at(i).next; @@ -1533,7 +1533,7 @@ impl StrExt for str { #[inline] fn trim_left_matches(&self, mut pat: P) -> &str { - match self.find(|&mut: c: char| !pat.matches(c)) { + match self.find(|c: char| !pat.matches(c)) { None => "", Some(first) => unsafe { self.slice_unchecked(first, self.len()) } } @@ -1541,7 +1541,7 @@ impl StrExt for str { #[inline] fn trim_right_matches(&self, mut pat: P) -> &str { - match self.rfind(|&mut: c: char| !pat.matches(c)) { + match self.rfind(|c: char| !pat.matches(c)) { None => "", Some(last) => { let next = self.char_range_at(last).next; diff --git a/src/libcoretest/finally.rs b/src/libcoretest/finally.rs index 22917b09ce995..42c2dfbda082a 100644 --- a/src/libcoretest/finally.rs +++ b/src/libcoretest/finally.rs @@ -47,8 +47,9 @@ fn test_fail() { #[test] fn test_retval() { - let mut closure = |&mut:| 10; - let i = closure.finally(|| { }); + let mut closure = || 10; + // FIXME(#16640) `: i32` annotation shouldn't be necessary + let i: i32 = closure.finally(|| { }); assert_eq!(i, 10); } diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index f2a1b0ac584d3..375564c39bb5b 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -54,7 +54,7 @@ fn test_rsplitn_char_iterator() { split.reverse(); assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); - let mut split: Vec<&str> = data.rsplitn(3, |&: c: char| c == ' ').collect(); + let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect(); split.reverse(); assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]); @@ -63,7 +63,7 @@ fn test_rsplitn_char_iterator() { split.reverse(); assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); - let mut split: Vec<&str> = data.rsplitn(3, |&: c: char| c == 'ä').collect(); + let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect(); split.reverse(); assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]); } @@ -79,10 +79,10 @@ fn test_split_char_iterator() { rsplit.reverse(); assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - let split: Vec<&str> = data.split(|&: c: char| c == ' ').collect(); + let split: Vec<&str> = data.split(|c: char| c == ' ').collect(); assert_eq!( split, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); - let mut rsplit: Vec<&str> = data.split(|&: c: char| c == ' ').rev().collect(); + let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect(); rsplit.reverse(); assert_eq!(rsplit, vec!["\nMäry", "häd", "ä", "little", "lämb\nLittle", "lämb\n"]); @@ -94,10 +94,10 @@ fn test_split_char_iterator() { rsplit.reverse(); assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - let split: Vec<&str> = data.split(|&: c: char| c == 'ä').collect(); + let split: Vec<&str> = data.split(|c: char| c == 'ä').collect(); assert_eq!( split, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); - let mut rsplit: Vec<&str> = data.split(|&: c: char| c == 'ä').rev().collect(); + let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect(); rsplit.reverse(); assert_eq!(rsplit, vec!["\nM", "ry h", "d ", " little l", "mb\nLittle l", "mb\n"]); } diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 9cfd4933ac229..322f572ee0dda 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -889,7 +889,7 @@ fn each_split_within(ss: &str, lim: uint, mut it: F) -> bool where lim = fake_i; } - let mut machine = |&mut: cont: &mut bool, (i, c): (uint, char)| -> bool { + let mut machine = |cont: &mut bool, (i, c): (uint, char)| -> bool { let whitespace = if c.is_whitespace() { Ws } else { Cr }; let limit = if (i - slice_start + 1) <= lim { UnderLim } else { OverLim }; diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 34216518c21d2..15f50188919b0 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -428,7 +428,7 @@ fn init() { DIRECTIVES = mem::transmute(box directives); // Schedule the cleanup for the globals for when the runtime exits. - rt::at_exit(move |:| { + rt::at_exit(move || { assert!(!DIRECTIVES.is_null()); let _directives: Box> = mem::transmute(DIRECTIVES); diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 53054f462c8b6..c2de380d094e6 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -949,7 +949,7 @@ impl NonSnakeCase { fn to_snake_case(mut str: &str) -> String { let mut words = vec![]; // Preserve leading underscores - str = str.trim_left_matches(|&mut: c: char| { + str = str.trim_left_matches(|c: char| { if c == '_' { words.push(String::new()); true diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index a787369dc633c..34bd1724e521b 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -72,7 +72,7 @@ struct CrateInfo { } pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option) { - let err = |&: s: &str| { + let err = |s: &str| { match (sp, sess) { (_, None) => panic!("{}", s), (Some(sp), Some(sess)) => sess.span_err(sp, s), diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 619cfc1b52c09..9eab0af558379 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -59,7 +59,7 @@ pub fn each_child_of_item(cstore: &cstore::CStore, F: FnMut(decoder::DefLike, ast::Name, ast::Visibility), { let crate_data = cstore.get_crate_data(def_id.krate); - let get_crate_data = |&mut: cnum| { + let get_crate_data = |cnum| { cstore.get_crate_data(cnum) }; decoder::each_child_of_item(cstore.intr.clone(), @@ -76,7 +76,7 @@ pub fn each_top_level_item_of_crate(cstore: &cstore::CStore, F: FnMut(decoder::DefLike, ast::Name, ast::Visibility), { let crate_data = cstore.get_crate_data(cnum); - let get_crate_data = |&mut: cnum| { + let get_crate_data = |cnum| { cstore.get_crate_data(cnum) }; decoder::each_top_level_item_of_crate(cstore.intr.clone(), diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index ccd524a2c0395..df5732e2f65fc 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1409,7 +1409,7 @@ fn encode_info_for_item(ecx: &EncodeContext, encode_parent_sort(rbml_w, 't'); let trait_item = &ms[i]; - let encode_trait_item = |&: rbml_w: &mut Encoder| { + let encode_trait_item = |rbml_w: &mut Encoder| { // If this is a static method, we've already // encoded this. if is_nonstatic_method { diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 925bd5b6395be..b558f838a51cb 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -138,7 +138,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) { ast::ExprBlock(ref block) => { // Check all statements in the block for stmt in &block.stmts { - let block_span_err = |&: span| + let block_span_err = |span| span_err!(v.tcx.sess, span, E0016, "blocks in constants are limited to items and \ tail expressions"); diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 38084d1c2c06f..418cdf957183f 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -1024,7 +1024,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt, }) } - let check_move = |&: p: &Pat, sub: Option<&Pat>| { + let check_move = |p: &Pat, sub: Option<&Pat>| { // check legality of moving out of the enum // x @ Foo(..) is legal, but x @ Foo(y) isn't. diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs index 87ea5436dab6b..64fdd45e36347 100644 --- a/src/librustc/middle/infer/region_inference/graphviz.rs +++ b/src/librustc/middle/infer/region_inference/graphviz.rs @@ -135,7 +135,7 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> { let mut i = 0; let mut node_ids = FnvHashMap(); { - let mut add_node = |&mut : node| { + let mut add_node = |node| { if let Vacant(e) = node_ids.entry(node) { e.insert(i); i += 1; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 87d386d94c972..e8215eb5660c0 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -666,7 +666,7 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) { { let region_maps = &mut visitor.region_maps; - let terminating = |&: id| { + let terminating = |id| { let scope = CodeExtent::from_node_id(id); region_maps.mark_as_terminating_scope(scope) }; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index a772555d8fcb6..5f4880fb2660b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6087,7 +6087,7 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) - macro_rules! byte { ($b:expr) => { ($b as u8).hash(state) } } macro_rules! hash { ($e:expr) => { $e.hash(state) } } - let region = |&: state: &mut SipHasher, r: Region| { + let region = |state: &mut SipHasher, r: Region| { match r { ReStatic => {} ReLateBound(db, BrAnon(i)) => { @@ -6104,7 +6104,7 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) - } } }; - let did = |&: state: &mut SipHasher, did: DefId| { + let did = |state: &mut SipHasher, did: DefId| { let h = if ast_util::is_local(did) { svh.clone() } else { @@ -6113,10 +6113,10 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) - h.as_str().hash(state); did.node.hash(state); }; - let mt = |&: state: &mut SipHasher, mt: mt| { + let mt = |state: &mut SipHasher, mt: mt| { mt.mutbl.hash(state); }; - let fn_sig = |&: state: &mut SipHasher, sig: &Binder>| { + let fn_sig = |state: &mut SipHasher, sig: &Binder>| { let sig = anonymize_late_bound_regions(tcx, sig).0; for a in &sig.inputs { helper(tcx, *a, svh, state); } if let ty::FnConverging(output) = sig.output { diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index b77a70f1f5d5a..d3d0f56c3ce90 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -187,8 +187,8 @@ pub fn can_reach(edges_map: &HashMap, S>, source: T, /// ``` /// pub fn memoized>( /// cache: &RefCell, -/// f: &|&: T| -> U -/// ) -> impl |&: T| -> U { +/// f: &|T| -> U +/// ) -> impl |T| -> U { /// ``` /// but currently it is not possible. /// diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 458701f2dd762..ff80bc550cb78 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -86,7 +86,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) return match region { ReScope(scope) => { let new_string; - let on_unknown_scope = |&:| { + let on_unknown_scope = || { (format!("unknown scope: {:?}. Please report a bug.", scope), None) }; let span = match scope.span(&cx.map) { diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index bffee9d49334d..afb5c948f1885 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -227,7 +227,7 @@ impl Target { let handler = diagnostic::default_handler(diagnostic::Auto, None, true); - let get_req_field = |&: name: &str| { + let get_req_field = |name: &str| { match obj.find(name) .map(|s| s.as_string()) .and_then(|os| os.map(|s| s.to_string())) { diff --git a/src/librustc_borrowck/borrowck/fragments.rs b/src/librustc_borrowck/borrowck/fragments.rs index 6f51ba3118278..ecbf3a4366d4a 100644 --- a/src/librustc_borrowck/borrowck/fragments.rs +++ b/src/librustc_borrowck/borrowck/fragments.rs @@ -43,7 +43,7 @@ enum Fragment { impl Fragment { fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String { - let repr = |&: mpi| move_data.path_loan_path(mpi).repr(tcx); + let repr = |mpi| move_data.path_loan_path(mpi).repr(tcx); match *self { Just(mpi) => repr(mpi), AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)), @@ -53,7 +53,7 @@ impl Fragment { fn loan_path_user_string<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String { - let user_string = |&: mpi| move_data.path_loan_path(mpi).user_string(tcx); + let user_string = |mpi| move_data.path_loan_path(mpi).user_string(tcx); match *self { Just(mpi) => user_string(mpi), AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)), @@ -139,9 +139,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>, if !span_err && !print { return; } - let instrument_all_paths = |&: kind, vec_rc: &Vec| { + let instrument_all_paths = |kind, vec_rc: &Vec| { for (i, mpi) in vec_rc.iter().enumerate() { - let render = |&:| this.path_loan_path(*mpi).user_string(tcx); + let render = || this.path_loan_path(*mpi).user_string(tcx); if span_err { tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]); } @@ -151,9 +151,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>, } }; - let instrument_all_fragments = |&: kind, vec_rc: &Vec| { + let instrument_all_fragments = |kind, vec_rc: &Vec| { for (i, f) in vec_rc.iter().enumerate() { - let render = |&:| f.loan_path_user_string(this, tcx); + let render = || f.loan_path_user_string(this, tcx); if span_err { tcx.sess.span_err(sp, &format!("{}: `{}`", kind, render())[]); } @@ -186,11 +186,11 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) { let mut moved = mem::replace(&mut fragments.moved_leaf_paths, vec![]); let mut assigned = mem::replace(&mut fragments.assigned_leaf_paths, vec![]); - let path_lps = |&: mpis: &[MovePathIndex]| -> Vec { + let path_lps = |mpis: &[MovePathIndex]| -> Vec { mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr(tcx)).collect() }; - let frag_lps = |&: fs: &[Fragment]| -> Vec { + let frag_lps = |fs: &[Fragment]| -> Vec { fs.iter().map(|f| f.loan_path_repr(this, tcx)).collect() }; @@ -343,7 +343,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>, Rc>)>) { let parent_ty = parent_lp.to_type(); - let mut add_fragment_sibling_local = |&mut : field_name, variant_did| { + let mut add_fragment_sibling_local = |field_name, variant_did| { add_fragment_sibling_core( this, tcx, gathered_fragments, parent_lp.clone(), mc, field_name, origin_lp, variant_did); diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index 311229717da1c..ac1e097be6ff2 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -58,7 +58,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { cmt: mc::cmt<'tcx>) -> RestrictionResult<'tcx> { debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx)); - let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); + let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); match cmt.cat.clone() { mc::cat_rvalue(..) => { diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index b9d2b9ec263ab..824518009802e 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -422,7 +422,7 @@ pub fn opt_loan_path<'tcx>(cmt: &mc::cmt<'tcx>) -> Option>> { //! which allows it to share common loan path pieces as it //! traverses the CMT. - let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); + let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); match cmt.cat { mc::cat_rvalue(..) | diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 8b1b156691af7..56bf3ae7fd5a3 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -99,7 +99,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { fn dataflow_loans_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String { let dfcx = &self.analysis_data.loans; - let loan_index_to_path = |&mut: loan_index| { + let loan_index_to_path = |loan_index| { let all_loans = &self.analysis_data.all_loans; let l: &borrowck::Loan = &all_loans[loan_index]; l.loan_path() @@ -109,7 +109,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { fn dataflow_moves_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String { let dfcx = &self.analysis_data.move_data.dfcx_moves; - let move_index_to_path = |&mut: move_index| { + let move_index_to_path = |move_index| { let move_data = &self.analysis_data.move_data.move_data; let moves = move_data.moves.borrow(); let the_move: &borrowck::move_data::Move = &(*moves)[move_index]; @@ -120,7 +120,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { fn dataflow_assigns_for(&self, e: EntryOrExit, cfgidx: CFGIndex) -> String { let dfcx = &self.analysis_data.move_data.dfcx_assign; - let assign_index_to_path = |&mut: assign_index| { + let assign_index_to_path = |assign_index| { let move_data = &self.analysis_data.move_data.move_data; let assignments = move_data.var_assignments.borrow(); let assignment: &borrowck::move_data::Assignment = &(*assignments)[assign_index]; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 8ede037594a00..5894c52886a32 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -214,7 +214,7 @@ impl<'a> PhaseController<'a> { pub fn basic() -> PhaseController<'a> { PhaseController { stop: false, - callback: box |&: _| {}, + callback: box |_| {}, } } } @@ -794,7 +794,7 @@ fn write_out_deps(sess: &Session, _ => return, }; - let result = (|&:| -> old_io::IoResult<()> { + let result = (|| -> old_io::IoResult<()> { // Build a list of files used to compile the output and // write Makefile-compatible dependency rules let files: Vec = sess.codemap().files.borrow() diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 4fe037d852f49..fd51d2f3b8ff3 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -93,7 +93,7 @@ pub mod driver; pub mod pretty; pub fn run(args: Vec) -> int { - monitor(move |:| run_compiler(args.as_slice())); + monitor(move || run_compiler(args.as_slice())); 0 } @@ -362,7 +362,7 @@ Available lint options: let max_name_len = plugin.iter().chain(builtin.iter()) .map(|&s| s.name.width(true)) .max().unwrap_or(0); - let padded = |&: x: &str| { + let padded = |x: &str| { let mut s = repeat(" ").take(max_name_len - x.chars().count()) .collect::(); s.push_str(x); @@ -373,7 +373,7 @@ Available lint options: println!(" {} {:7.7} {}", padded("name"), "default", "meaning"); println!(" {} {:7.7} {}", padded("----"), "-------", "-------"); - let print_lints = |&: lints: Vec<&Lint>| { + let print_lints = |lints: Vec<&Lint>| { for lint in lints { let name = lint.name_lower().replace("_", "-"); println!(" {} {:7.7} {}", @@ -389,7 +389,7 @@ Available lint options: let max_name_len = plugin_groups.iter().chain(builtin_groups.iter()) .map(|&(s, _)| s.width(true)) .max().unwrap_or(0); - let padded = |&: x: &str| { + let padded = |x: &str| { let mut s = repeat(" ").take(max_name_len - x.chars().count()) .collect::(); s.push_str(x); @@ -400,7 +400,7 @@ Available lint options: println!(" {} {}", padded("name"), "sub-lints"); println!(" {} {}", padded("----"), "---------"); - let print_lint_groups = |&: lints: Vec<(&'static str, Vec)>| { + let print_lint_groups = |lints: Vec<(&'static str, Vec)>| { for (name, to) in lints { let name = name.chars().map(|x| x.to_lowercase()) .collect::().replace("_", "-"); diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index ea7e59560cda9..27e607dad59a8 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -388,7 +388,7 @@ impl UserIdentifiedItem { } fn to_one_node_id(self, user_option: &str, sess: &Session, map: &ast_map::Map) -> ast::NodeId { - let fail_because = |&: is_wrong_because| -> ast::NodeId { + let fail_because = |is_wrong_because| -> ast::NodeId { let message = format!("{} needs NodeId (int) or unique \ path suffix (b::c::d); got {}, which {}", diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index c398ff72f504a..aa9b6c479bb78 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -719,8 +719,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> { fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) { debug!("privacy - path {}", self.nodestr(path_id)); let orig_def = self.tcx.def_map.borrow()[path_id].clone(); - let ck = |&: tyname: &str| { - let ck_public = |&: def: ast::DefId| { + let ck = |tyname: &str| { + let ck_public = |def: ast::DefId| { debug!("privacy - ck_public {:?}", def); let name = token::get_ident(path.segments.last().unwrap().identifier); let origdid = orig_def.def_id(); @@ -924,7 +924,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> { } } ast::ExprPath(_) | ast::ExprQPath(_) => { - let guard = |&: did: ast::DefId| { + let guard = |did: ast::DefId| { let fields = ty::lookup_struct_fields(self.tcx, did); let any_priv = fields.iter().any(|f| { f.vis != ast::Public && ( @@ -1076,7 +1076,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> { /// later on down the road... fn check_sane_privacy(&self, item: &ast::Item) { let tcx = self.tcx; - let check_inherited = |&: sp: Span, vis: ast::Visibility, note: &str| { + let check_inherited = |sp: Span, vis: ast::Visibility, note: &str| { if vis != ast::Inherited { tcx.sess.span_err(sp, "unnecessary visibility qualifier"); if note.len() > 0 { @@ -1156,7 +1156,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> { tcx.sess.span_err(sp, "visibility has no effect inside functions"); } } - let check_struct = |&: def: &ast::StructDef| { + let check_struct = |def: &ast::StructDef| { for f in &def.fields { match f.node.kind { ast::NamedField(_, p) => check_inherited(tcx, f.span, p), diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index dd739059ed0dd..27ab1cdbdded7 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1475,7 +1475,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let mut import_resolutions = module_.import_resolutions.borrow_mut(); let import_resolution = &mut (*import_resolutions)[target]; { - let mut check_and_write_import = |&mut: namespace, result: &_, used_public: &mut bool| { + let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| { let namespace_name = match namespace { TypeNS => "type", ValueNS => "value", @@ -1714,7 +1714,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // Merge the child item into the import resolution. { - let mut merge_child_item = |&mut : namespace| { + let mut merge_child_item = |namespace| { if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) { let namespace_name = match namespace { TypeNS => "type", diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index f841b6cf494de..81dbd13077d45 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -126,7 +126,7 @@ pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint = pub fn find_crate_name(sess: Option<&Session>, attrs: &[ast::Attribute], input: &Input) -> String { - let validate = |&: s: String, span: Option| { + let validate = |s: String, span: Option| { creader::validate_crate_name(sess, &s[], span); s }; @@ -1006,7 +1006,7 @@ fn link_args(cmd: &mut Command, if sess.opts.cg.rpath { let sysroot = sess.sysroot(); let target_triple = &sess.opts.target_triple[]; - let get_install_prefix_lib_path = |:| { + let get_install_prefix_lib_path = || { let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX"); let tlib = filesearch::relative_target_lib_path(sysroot, target_triple); let mut path = Path::new(install_prefix); diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 5312d2ca1ddee..8cd2e5905606d 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -439,7 +439,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext, // If we're verifying or linting, add them to the function pass // manager. - let addpass = |&: pass: &str| { + let addpass = |pass: &str| { let pass = CString::from_slice(pass.as_bytes()); llvm::LLVMRustAddPass(fpm, pass.as_ptr()) }; @@ -660,7 +660,7 @@ pub fn run_passes(sess: &Session, // Produce final compile outputs. - let copy_if_one_unit = |&: ext: &str, output_type: config::OutputType, keep_numbered: bool| { + let copy_if_one_unit = |ext: &str, output_type: config::OutputType, keep_numbered: bool| { // Three cases: if sess.opts.cg.codegen_units == 1 { // 1) Only one codegen unit. In this case it's no difficulty @@ -685,7 +685,7 @@ pub fn run_passes(sess: &Session, } }; - let link_obj = |&: output_path: &Path| { + let link_obj = |output_path: &Path| { // Running `ld -r` on a single input is kind of pointless. if sess.opts.cg.codegen_units == 1 { fs::copy(&crate_output.with_extension("0.o"), @@ -910,7 +910,7 @@ fn run_work_multithreaded(sess: &Session, let mut tx = Some(tx); futures.push(rx); - thread::Builder::new().name(format!("codegen-{}", i)).spawn(move |:| { + thread::Builder::new().name(format!("codegen-{}", i)).spawn(move || { let diag_handler = mk_handler(true, box diag_emitter); // Must construct cgcx inside the proc because it has non-Send @@ -1001,7 +1001,7 @@ unsafe fn configure_llvm(sess: &Session) { let mut llvm_c_strs = Vec::new(); let mut llvm_args = Vec::new(); { - let mut add = |&mut : arg: &str| { + let mut add = |arg: &str| { let s = CString::from_slice(arg.as_bytes()); llvm_args.push(s.as_ptr()); llvm_c_strs.push(s); diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 52fe8797592b5..04d2fe7627ace 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -747,7 +747,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option { } } - let column_score = |&: m: &[Match], col: uint| -> uint { + let column_score = |m: &[Match], col: uint| -> uint { let total_score = m.iter() .map(|row| row.pats[col]) .map(|pat| pat_score(def_map, pat)) @@ -761,7 +761,7 @@ fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option { } }; - let column_contains_any_nonwild_patterns = |&: &col: &uint| -> bool { + let column_contains_any_nonwild_patterns = |&col: &uint| -> bool { m.iter().any(|row| match row.pats[col].node { ast::PatWild(_) => false, _ => true diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index c2af6ec8c8ad8..062a21dffa8ad 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -540,7 +540,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>, t: Ty<'tcx>, op: ast::BinOp_) -> Result<'blk, 'tcx> { - let f = |&: a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op)); + let f = |a| Result::new(cx, compare_scalar_values(cx, lhs, rhs, a, op)); match t.sty { ty::ty_tup(ref tys) if tys.is_empty() => f(nil_type), @@ -2757,7 +2757,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef { let val = match item { ast_map::NodeItem(i) => { let ty = ty::node_id_to_type(ccx.tcx(), i.id); - let sym = |&:| exported_name(ccx, id, ty, &i.attrs[]); + let sym = || exported_name(ccx, id, ty, &i.attrs[]); let v = match i.node { ast::ItemStatic(_, _, ref expr) => { @@ -3016,14 +3016,14 @@ fn internalize_symbols(cx: &SharedCrateContext, reachable: &HashSet) { unsafe { let mut declared = HashSet::new(); - let iter_globals = |&: llmod| { + let iter_globals = |llmod| { ValueIter { cur: llvm::LLVMGetFirstGlobal(llmod), step: llvm::LLVMGetNextGlobal, } }; - let iter_functions = |&: llmod| { + let iter_functions = |llmod| { ValueIter { cur: llvm::LLVMGetFirstFunction(llmod), step: llvm::LLVMGetNextFunction, diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index 0403a2f2e3c67..17a92fe649d28 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -289,7 +289,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) // the bool returned is whether this expression can be inlined into other crates // if it's assigned to a static. fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { - let map_list = |&: exprs: &[P]| { + let map_list = |exprs: &[P]| { exprs.iter().map(|e| const_expr(cx, &**e).0) .fold(Vec::new(), |mut l, val| { l.push(val); l }) }; diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index c6b70e1a1abc3..1100c873e0fa2 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -2453,7 +2453,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, }) .collect(); - let discriminant_type_metadata = |&: inttype| { + let discriminant_type_metadata = |inttype| { // We can reuse the type of the discriminant for all monomorphized // instances of an enum because it doesn't depend on any type parameters. // The def_id, uniquely identifying the enum's polytype acts as key in diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 44eb5b190e1a6..332f85f116b46 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -350,7 +350,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, debug!("dest_ty={}", unsized_ty.repr(bcx.tcx())); // Closures for extracting and manipulating the data and payload parts of // the fat pointer. - let info = |: bcx, _val| unsized_info(bcx, + let info = |bcx, _val| unsized_info(bcx, k, expr.id, datum_ty, @@ -382,8 +382,8 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, -> DatumBlock<'blk, 'tcx, Expr> { let tcx = bcx.tcx(); let dest_ty = ty::close_type(tcx, datum.ty); - let base = |: bcx, val| Load(bcx, get_dataptr(bcx, val)); - let len = |: bcx, val| Load(bcx, get_len(bcx, val)); + let base = |bcx, val| Load(bcx, get_dataptr(bcx, val)); + let len = |bcx, val| Load(bcx, get_len(bcx, val)); into_fat_ptr(bcx, expr, datum, dest_ty, base, len) } diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index 00bb303654676..f2d80f36297f7 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -431,7 +431,7 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // ABIs are handled at all correctly. fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) { if !tcx.sess.features.borrow().simd_ffi { - let check = |&: ast_ty: &ast::Ty, ty: ty::Ty| { + let check = |ast_ty: &ast::Ty, ty: ty::Ty| { if ty::type_is_simd(tcx, ty) { tcx.sess.span_err(ast_ty.span, &format!("use of SIMD type `{}` in FFI is highly experimental and \ @@ -649,7 +649,7 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // Array for the arguments we will pass to the rust function. let mut llrust_args = Vec::new(); let mut next_foreign_arg_counter: c_uint = 0; - let mut next_foreign_arg = |&mut : pad: bool| -> c_uint { + let mut next_foreign_arg = |pad: bool| -> c_uint { next_foreign_arg_counter += if pad { 2 } else { diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 6228043eeb1a9..be8a4ec89e065 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -183,7 +183,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, // This should be caught by the intrinsicck pass assert_eq!(in_type_size, out_type_size); - let nonpointer_nonaggregate = |&: llkind: TypeKind| -> bool { + let nonpointer_nonaggregate = |llkind: TypeKind| -> bool { use llvm::TypeKind::*; match llkind { Half | Float | Double | X86_FP80 | FP128 | diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs index b3d388b0f0236..5796e72a61018 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/trans/monomorphize.rs @@ -139,7 +139,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, // This shouldn't need to option dance. let mut hash_id = Some(hash_id); - let mut mk_lldecl = |&mut : abi: abi::Abi| { + let mut mk_lldecl = |abi: abi::Abi| { let lldecl = if abi != abi::Rust { foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, &s[]) } else { @@ -149,7 +149,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ccx.monomorphized().borrow_mut().insert(hash_id.take().unwrap(), lldecl); lldecl }; - let setup_lldecl = |&: lldecl, attrs: &[ast::Attribute]| { + let setup_lldecl = |lldecl, attrs: &[ast::Attribute]| { base::update_linkage(ccx, lldecl, None, base::OriginalTranslation); set_llvm_fn_attrs(ccx, attrs, lldecl); diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index c22d2a9bb416f..063300a1d7280 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -342,7 +342,7 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> { } } let cstore = &ccx.tcx.sess.cstore; - cstore.iter_crate_data(|&mut: cnum, _| { + cstore.iter_crate_data(|cnum, _| { csearch::each_top_level_item_of_crate(cstore, cnum, |dl, _, _| { handle_external_def(&mut traits, ccx, cstore, dl) }) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index adf15fbf28a8f..fdb2f64732fce 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -801,7 +801,7 @@ pub fn check_item<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx ast::Item) { fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, generics: &ast::Generics, item: &ast::Item) { - if let Some(ref attr) = item.attrs.iter().find(|&: a| { + if let Some(ref attr) = item.attrs.iter().find(|a| { a.check_name("rustc_on_unimplemented") }) { if let Some(ref istring) = attr.value_str() { @@ -1715,7 +1715,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { let raw_ty = self.expr_ty(expr); let raw_ty = self.infcx().shallow_resolve(raw_ty); - let resolve_ty = |&: ty: Ty<'tcx>| self.infcx().resolve_type_vars_if_possible(&ty); + let resolve_ty = |ty: Ty<'tcx>| self.infcx().resolve_type_vars_if_possible(&ty); ty::adjust_ty(self.tcx(), expr.span, expr.id, diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index 40197ee2c4988..2596f90bfc626 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -597,7 +597,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { // parameter (by inspecting parent of its binding declaration // to see if it is introduced by a type or by a fn/impl). - let check_result = |&: this:&ConstraintContext| -> bool { + let check_result = |this:&ConstraintContext| -> bool { let tcx = this.terms_cx.tcx; let decl_id = this.find_binding_for_lifetime(param_id); // Currently only called on lifetimes; double-checking that. diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 38b191846f198..8c0ab654ce498 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -61,7 +61,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, loop { let next = lexer.next_token(); - let snip = |&: sp| sess.span_diagnostic.cm.span_to_snippet(sp).unwrap(); + let snip = |sp| sess.span_diagnostic.cm.span_to_snippet(sp).unwrap(); if next.tok == token::Eof { break } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 7e08226019f98..415d4903902c2 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -420,7 +420,7 @@ impl LangString { let mut seen_other_tags = false; let mut data = LangString::all_false(); - let tokens = string.split(|&: c: char| + let tokens = string.split(|c: char| !(c == '_' || c == '-' || c.is_alphanumeric()) ); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index f4b8bbd5f8a51..a820fd4d50a12 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -365,7 +365,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche let cr = Path::new(cratefile); info!("starting to run rustc"); - let (mut krate, analysis) = std::thread::Thread::scoped(move |:| { + let (mut krate, analysis) = std::thread::Thread::scoped(move || { use rustc::session::config::Input; let cr = cr; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 29abea009e547..aa5cdb9da5fc0 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -148,7 +148,7 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths, let w1 = old_io::ChanWriter::new(tx); let w2 = w1.clone(); let old = old_io::stdio::set_stderr(box w1); - Thread::spawn(move |:| { + Thread::spawn(move || { let mut p = old_io::ChanReader::new(rx); let mut err = match old { Some(old) => { diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 9c4741b3ce316..4ae7d3437fd93 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -321,10 +321,10 @@ pub fn float_to_str_bytes_common( // cut off the one extra digit, and depending on its value // round the remaining ones. if limit_digits && dig == digit_count { - let ascii2value = |&: chr: u8| { + let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |&: val: uint| { + let value2ascii = |val: uint| { char::from_digit(val, radix).unwrap() as u8 }; diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index d85251795c887..9c89c94399463 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -323,25 +323,25 @@ impl<'a> Parser<'a> { } fn read_ip_addr(&mut self) -> Option { - let ipv4_addr = |&mut: p: &mut Parser| p.read_ipv4_addr(); - let ipv6_addr = |&mut: p: &mut Parser| p.read_ipv6_addr(); + let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr(); + let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr(); self.read_or(&mut [box ipv4_addr, box ipv6_addr]) } fn read_socket_addr(&mut self) -> Option { - let ip_addr = |&: p: &mut Parser| { - let ipv4_p = |&mut: p: &mut Parser| p.read_ip_addr(); - let ipv6_p = |&mut: p: &mut Parser| { - let open_br = |&: p: &mut Parser| p.read_given_char('['); - let ip_addr = |&: p: &mut Parser| p.read_ipv6_addr(); - let clos_br = |&: p: &mut Parser| p.read_given_char(']'); + let ip_addr = |p: &mut Parser| { + let ipv4_p = |p: &mut Parser| p.read_ip_addr(); + let ipv6_p = |p: &mut Parser| { + let open_br = |p: &mut Parser| p.read_given_char('['); + let ip_addr = |p: &mut Parser| p.read_ipv6_addr(); + let clos_br = |p: &mut Parser| p.read_given_char(']'); p.read_seq_3::(open_br, ip_addr, clos_br) .map(|t| match t { (_, ip, _) => ip }) }; p.read_or(&mut [box ipv4_p, box ipv6_p]) }; - let colon = |&: p: &mut Parser| p.read_given_char(':'); - let port = |&: p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16); + let colon = |p: &mut Parser| p.read_given_char(':'); + let port = |p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16); // host, colon, port self.read_seq_3::(ip_addr, colon, port) diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 27af957e18e18..9039514249493 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -703,7 +703,7 @@ impl Process { let (tx, rx) = channel(); match stream { Some(stream) => { - Thread::spawn(move |:| { + Thread::spawn(move || { let mut stream = stream; tx.send(stream.read_to_end()).unwrap(); }); diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index b3bed4af96248..c2f5133eaf3fe 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -125,7 +125,7 @@ mod imp { assert!(take() == Some(expected.clone())); assert!(take() == None); - (|&mut:| { + (|| { }).finally(|| { // Restore the actual global state. match saved_value { diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 8340652d19ae6..a230e35dac8c3 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -126,7 +126,7 @@ impl Future { * waiting for the result to be received on the port. */ - Future::from_fn(move |:| { + Future::from_fn(move || { rx.recv().unwrap() }) } @@ -143,7 +143,7 @@ impl Future { let (tx, rx) = channel(); - Thread::spawn(move |:| { + Thread::spawn(move || { // Don't panic if the other end has hung up let _ = tx.send(blk()); }); diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 1bfcbcf96f144..684a46fd6ff5f 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -112,7 +112,7 @@ impl TaskPool { } fn spawn_in_pool(jobs: Arc>>) { - Thread::spawn(move |:| { + Thread::spawn(move || { // Will spawn a new thread on panic unless it is cancelled. let sentinel = Sentinel::new(&jobs); diff --git a/src/libstd/sys/common/helper_thread.rs b/src/libstd/sys/common/helper_thread.rs index 6f6179a436e91..255f474d4f4af 100644 --- a/src/libstd/sys/common/helper_thread.rs +++ b/src/libstd/sys/common/helper_thread.rs @@ -95,14 +95,14 @@ impl Helper { let receive = RaceBox(receive); let t = f(); - Thread::spawn(move |:| { + Thread::spawn(move || { helper(receive.0, rx, t); let _g = self.lock.lock().unwrap(); *self.shutdown.get() = true; self.cond.notify_one() }); - rt::at_exit(move|:| { self.shutdown() }); + rt::at_exit(move|| { self.shutdown() }); *self.initialized.get() = true; } } diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 833de8adda49d..7325e0a5ac8dd 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -723,8 +723,8 @@ impl TcpStream { pub fn read(&mut self, buf: &mut [u8]) -> IoResult { let fd = self.fd(); - let dolock = |&:| self.lock_nonblocking(); - let doread = |&mut: nb| unsafe { + let dolock = || self.lock_nonblocking(); + let doread = |nb| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::recv(fd, buf.as_mut_ptr() as *mut libc::c_void, @@ -736,8 +736,8 @@ impl TcpStream { pub fn write(&mut self, buf: &[u8]) -> IoResult<()> { let fd = self.fd(); - let dolock = |&:| self.lock_nonblocking(); - let dowrite = |&: nb: bool, buf: *const u8, len: uint| unsafe { + let dolock = || self.lock_nonblocking(); + let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::send(fd, buf as *const _, @@ -871,7 +871,7 @@ impl UdpSocket { let mut addrlen: libc::socklen_t = mem::size_of::() as libc::socklen_t; - let dolock = |&:| self.lock_nonblocking(); + let dolock = || self.lock_nonblocking(); let n = try!(read(fd, self.read_deadline, dolock, |nb| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::recvfrom(fd, @@ -892,8 +892,8 @@ impl UdpSocket { let dstp = &storage as *const _ as *const libc::sockaddr; let fd = self.fd(); - let dolock = |&: | self.lock_nonblocking(); - let dowrite = |&mut: nb, buf: *const u8, len: uint| unsafe { + let dolock = || self.lock_nonblocking(); + let dowrite = |nb, buf: *const u8, len: uint| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::sendto(fd, buf as *const libc::c_void, diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index 16274a2ab0820..45d5b1506c3aa 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -151,8 +151,8 @@ impl UnixStream { pub fn read(&mut self, buf: &mut [u8]) -> IoResult { let fd = self.fd(); - let dolock = |&:| self.lock_nonblocking(); - let doread = |&mut: nb| unsafe { + let dolock = || self.lock_nonblocking(); + let doread = |nb| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::recv(fd, buf.as_mut_ptr() as *mut libc::c_void, @@ -164,8 +164,8 @@ impl UnixStream { pub fn write(&mut self, buf: &[u8]) -> IoResult<()> { let fd = self.fd(); - let dolock = |&: | self.lock_nonblocking(); - let dowrite = |&: nb: bool, buf: *const u8, len: uint| unsafe { + let dolock = || self.lock_nonblocking(); + let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::send(fd, buf as *const _, diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 20f86227e8eaf..52a8ac9c338e0 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -84,8 +84,8 @@ impl Process { mem::transmute::<&ProcessConfig,&'static ProcessConfig>(cfg) }; - with_envp(cfg.env(), move|: envp: *const c_void| { - with_argv(cfg.program(), cfg.args(), move|: argv: *const *const libc::c_char| unsafe { + with_envp(cfg.env(), move|envp: *const c_void| { + with_argv(cfg.program(), cfg.args(), move|argv: *const *const libc::c_char| unsafe { let (input, mut output) = try!(sys::os::pipe()); // We may use this in the child, so perform allocations before the @@ -185,7 +185,7 @@ impl Process { // up /dev/null into that file descriptor. Otherwise, the first file // descriptor opened up in the child would be numbered as one of the // stdio file descriptors, which is likely to wreak havoc. - let setup = |&: src: Option

, dst: c_int| { + let setup = |src: Option

, dst: c_int| { let src = match src { None => { let flags = if dst == libc::STDIN_FILENO { diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 315c41e779a36..839263f1f1720 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -169,7 +169,7 @@ impl Process { // Similarly to unix, we don't actually leave holes for the stdio file // descriptors, but rather open up /dev/null equivalents. These // equivalents are drawn from libuv's windows process spawning. - let set_fd = |&: fd: &Option

, slot: &mut HANDLE, + let set_fd = |fd: &Option

, slot: &mut HANDLE, is_stdin: bool| { match *fd { None => { diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index c791ee2717b0b..52399ff771e8d 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -246,7 +246,7 @@ impl Builder { { let my_packet = Packet(Arc::new(UnsafeCell::new(None))); let their_packet = Packet(my_packet.0.clone()); - let (native, thread) = self.spawn_inner(Thunk::new(f), Thunk::with_arg(move |: ret| unsafe { + let (native, thread) = self.spawn_inner(Thunk::new(f), Thunk::with_arg(move |ret| unsafe { *their_packet.0.get() = Some(ret); })); @@ -273,7 +273,7 @@ impl Builder { // because by the time that this function is executing we've already // consumed at least a little bit of stack (we don't know the exact byte // address at which our stack started). - let main = move |:| { + let main = move || { let something_around_the_top_of_the_stack = 1; let addr = &something_around_the_top_of_the_stack as *const int; let my_stack_top = addr as uint; @@ -289,7 +289,7 @@ impl Builder { let mut output = None; let f: Thunk<(), T> = if stdout.is_some() || stderr.is_some() { - Thunk::new(move |:| { + Thunk::new(move || { let _ = stdout.map(stdio::set_stdout); let _ = stderr.map(stdio::set_stderr); f.invoke(()) diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs index 2e53d0ceecbdf..0831242f954cf 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -24,7 +24,7 @@ impl Thunk<(),R> { pub fn new(func: F) -> Thunk<(),R> where F : FnOnce() -> R, F : Send { - Thunk::with_arg(move|: ()| func()) + Thunk::with_arg(move|()| func()) } } diff --git a/src/libsyntax/ast_map/blocks.rs b/src/libsyntax/ast_map/blocks.rs index a85b87f47d6ee..1a537c7a5b8f8 100644 --- a/src/libsyntax/ast_map/blocks.rs +++ b/src/libsyntax/ast_map/blocks.rs @@ -179,13 +179,13 @@ impl<'a> FnLikeNode<'a> { } pub fn kind(self) -> visit::FnKind<'a> { - let item = |: p: ItemFnParts<'a>| -> visit::FnKind<'a> { + let item = |p: ItemFnParts<'a>| -> visit::FnKind<'a> { visit::FkItemFn(p.ident, p.generics, p.unsafety, p.abi) }; - let closure = |: _: ClosureParts| { + let closure = |_: ClosureParts| { visit::FkFnBlock }; - let method = |: m: &'a ast::Method| { + let method = |m: &'a ast::Method| { visit::FkMethod(m.pe_ident(), m.pe_generics(), m) }; self.handle(item, method, closure) diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index e1dcc88777823..6eb18e290238e 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -63,7 +63,7 @@ fn cs_clone( cx.ident_of("Clone"), cx.ident_of("clone"), ]; - let subcall = |&: field: &FieldInfo| { + let subcall = |field: &FieldInfo| { let args = vec![cx.expr_addr_of(field.span, field.self_.clone())]; cx.expr_call_global(field.span, fn_path.clone(), args) diff --git a/src/libsyntax/ext/deriving/default.rs b/src/libsyntax/ext/deriving/default.rs index 27f3c46c48fce..df5e1863d551d 100644 --- a/src/libsyntax/ext/deriving/default.rs +++ b/src/libsyntax/ext/deriving/default.rs @@ -57,7 +57,7 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur cx.ident_of("Default"), cx.ident_of("default") ); - let default_call = |&: span| cx.expr_call_global(span, default_ident.clone(), Vec::new()); + let default_call = |span| cx.expr_call_global(span, default_ident.clone(), Vec::new()); return match *substr.fields { StaticStruct(_, ref summary) => { diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 02982039be0a3..7d72a7ec358c8 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -957,7 +957,7 @@ impl<'a> MethodDef<'a> { // where each tuple has length = self_args.len() let mut match_arms: Vec = variants.iter().enumerate() .map(|(index, variant)| { - let mk_self_pat = |&: cx: &mut ExtCtxt, self_arg_name: &str| { + let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| { let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident, &**variant, self_arg_name, diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs index efd9322661862..f8a7af3aa9170 100644 --- a/src/libsyntax/ext/deriving/hash.rs +++ b/src/libsyntax/ext/deriving/hash.rs @@ -66,7 +66,7 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) [ref state_expr] => state_expr, _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`") }; - let call_hash = |&: span, thing_expr| { + let call_hash = |span, thing_expr| { let hash_path = { let strs = vec![ cx.ident_of("std"), diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 0b57e7e7c8e9e..c708a09b53c9b 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -70,7 +70,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) cx.ident_of("Rand"), cx.ident_of("rand") ); - let rand_call = |&: cx: &mut ExtCtxt, span| { + let rand_call = |cx: &mut ExtCtxt, span| { cx.expr_call_global(span, rand_ident.clone(), vec!(rng.clone())) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 77440914342fb..fbacc75039005 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1089,7 +1089,7 @@ fn expand_annotatable(a: Annotatable, // but that double-mut-borrows fld let mut items: SmallVector> = SmallVector::zero(); dec.expand(fld.cx, attr.span, &*attr.node.value, &**it, - box |&mut: item| items.push(item)); + box |item| items.push(item)); decorator_items.extend(items.into_iter() .flat_map(|item| expand_item(item, fld).into_iter())); @@ -1850,7 +1850,7 @@ mod test { assert!((shouldmatch.len() == 0) || (varrefs.len() > *shouldmatch.iter().max().unwrap())); for (idx,varref) in varrefs.iter().enumerate() { - let print_hygiene_debug_info = |&:| { + let print_hygiene_debug_info = || { // good lord, you can't make a path with 0 segments, can you? let final_varref_ident = match varref.segments.last() { Some(pathsegment) => pathsegment.identifier, diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 16aaccb0207a2..56da24de8bbe2 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -307,7 +307,7 @@ impl<'a, 'b> Context<'a, 'b> { fn trans_count(&self, c: parse::Count) -> P { let sp = self.fmtsp; - let count = |: c, arg| { + let count = |c, arg| { let mut path = Context::rtpath(self.ecx, "Count"); path.push(self.ecx.ident_of(c)); match arg { @@ -353,7 +353,7 @@ impl<'a, 'b> Context<'a, 'b> { parse::NextArgument(ref arg) => { // Translate the position let pos = { - let pos = |: c, arg| { + let pos = |c, arg| { let mut path = Context::rtpath(self.ecx, "Position"); path.push(self.ecx.ident_of(c)); match arg { @@ -404,7 +404,7 @@ impl<'a, 'b> Context<'a, 'b> { // Translate the format let fill = self.ecx.expr_lit(sp, ast::LitChar(fill)); - let align = |:name| { + let align = |name| { let mut p = Context::rtpath(self.ecx, "Alignment"); p.push(self.ecx.ident_of(name)); self.ecx.path_global(sp, p) diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 9092169e18200..7376b2352388a 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -791,11 +791,11 @@ fn expand_parse_call(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> P { let (cx_expr, tts_expr) = expand_tts(cx, sp, tts); - let cfg_call = |&:| cx.expr_method_call( + let cfg_call = || cx.expr_method_call( sp, cx.expr_ident(sp, id_ext("ext_cx")), id_ext("cfg"), Vec::new()); - let parse_sess_call = |&:| cx.expr_method_call( + let parse_sess_call = || cx.expr_method_call( sp, cx.expr_ident(sp, id_ext("ext_cx")), id_ext("parse_sess"), Vec::new()); diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index eecd7d8718543..6ea2ffa507d7c 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -244,7 +244,7 @@ pub fn new_parser_from_tts<'a>(sess: &'a ParseSess, /// add the path to the session's codemap and return the new filemap. pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) -> Rc { - let err = |&: msg: &str| { + let err = |msg: &str| { match spanopt { Some(sp) => sess.span_diagnostic.span_fatal(sp, msg), None => sess.span_diagnostic.handler().fatal(msg), @@ -406,7 +406,7 @@ pub fn char_lit(lit: &str) -> (char, isize) { .map(|x| (x, len as isize)) } - let unicode_escape = |&: | -> Option<(char, isize)> + let unicode_escape = || -> Option<(char, isize)> if lit.as_bytes()[2] == b'{' { let idx = lit.find('}').expect(msg2); let subslice = &lit[3..idx]; @@ -433,7 +433,7 @@ pub fn str_lit(lit: &str) -> String { let mut res = String::with_capacity(lit.len()); // FIXME #8372: This could be a for-loop if it didn't borrow the iterator - let error = |&: i| format!("lexer should have rejected {} at {}", lit, i); + let error = |i| format!("lexer should have rejected {} at {}", lit, i); /// Eat everything up to a non-whitespace fn eat<'a>(it: &mut iter::Peekable>) { @@ -568,7 +568,7 @@ pub fn float_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> a /// Parse a string representing a byte literal into its final form. Similar to `char_lit` pub fn byte_lit(lit: &str) -> (u8, usize) { - let err = |&: i| format!("lexer accepted invalid byte literal {} step {}", lit, i); + let err = |i| format!("lexer accepted invalid byte literal {} step {}", lit, i); if lit.len() == 1 { (lit.as_bytes()[0], 1) @@ -602,7 +602,7 @@ pub fn binary_lit(lit: &str) -> Rc> { let mut res = Vec::with_capacity(lit.len()); // FIXME #8372: This could be a for-loop if it didn't borrow the iterator - let error = |&: i| format!("lexer should have rejected {} at {}", lit, i); + let error = |i| format!("lexer should have rejected {} at {}", lit, i); /// Eat everything up to a non-whitespace fn eat<'a, I: Iterator>(it: &mut iter::Peekable) { diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 61ce664d2c790..d9d5688951288 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -609,11 +609,11 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P { let test_id = ecx.ident_of("test"); // creates self::test::$name - let test_path = |&: name| { + let test_path = |name| { ecx.path(span, vec![self_id, test_id, ecx.ident_of(name)]) }; // creates $name: $expr - let field = |&: name, expr| ecx.field_imm(span, ecx.ident_of(name), expr); + let field = |name, expr| ecx.field_imm(span, ecx.ident_of(name), expr); debug!("encoding {}", ast_util::path_name_i(&path[])); @@ -627,7 +627,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P { vec![name_expr]); let ignore_expr = ecx.expr_bool(span, test.ignore); - let should_fail_path = |&: name| { + let should_fail_path = |name| { ecx.path(span, vec![self_id, test_id, ecx.ident_of("ShouldFail"), ecx.ident_of(name)]) }; let fail_expr = match test.should_fail { diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index ff8246a0e3f87..a89fcbee25bc7 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -89,12 +89,12 @@ impl UnicodeStr for str { #[inline] fn trim_left(&self) -> &str { - self.trim_left_matches(|&: c: char| c.is_whitespace()) + self.trim_left_matches(|c: char| c.is_whitespace()) } #[inline] fn trim_right(&self) -> &str { - self.trim_right_matches(|&: c: char| c.is_whitespace()) + self.trim_right_matches(|c: char| c.is_whitespace()) } } diff --git a/src/test/auxiliary/issue-18711.rs b/src/test/auxiliary/issue-18711.rs index 54f1595780db7..a29dcc00cddf8 100644 --- a/src/test/auxiliary/issue-18711.rs +++ b/src/test/auxiliary/issue-18711.rs @@ -12,5 +12,5 @@ #![crate_type = "rlib"] pub fn inner(f: F) -> F { - (move |:| f)() + (move || f)() } diff --git a/src/test/auxiliary/logging_right_crate.rs b/src/test/auxiliary/logging_right_crate.rs index 67037a3ac9e08..bf4ab975cedd8 100644 --- a/src/test/auxiliary/logging_right_crate.rs +++ b/src/test/auxiliary/logging_right_crate.rs @@ -12,5 +12,5 @@ pub fn foo() { fn death() -> int { panic!() } - debug!("{}", (|&:|{ death() })()); + debug!("{}", (||{ death() })()); } diff --git a/src/test/auxiliary/unboxed-closures-cross-crate.rs b/src/test/auxiliary/unboxed-closures-cross-crate.rs index 4bc45caa170e4..f03bcb41fafe8 100644 --- a/src/test/auxiliary/unboxed-closures-cross-crate.rs +++ b/src/test/auxiliary/unboxed-closures-cross-crate.rs @@ -15,14 +15,14 @@ use std::ops::Add; #[inline] pub fn has_closures() -> uint { let x = 1u; - let mut f = move |&mut:| x; + let mut f = move || x; let y = 1u; - let g = |:| y; + let g = || y; f() + g() } pub fn has_generic_closures + Copy>(x: T, y: T) -> T { - let mut f = move |&mut:| x; - let g = |:| y; + let mut f = move || x; + let g = || y; f() + g() } diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 3a35bea0d5997..dd8e7fdfbdeec 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -251,6 +251,6 @@ fn parallel<'a, I, T, F>(iter: I, f: F) fn main() { let mut data = read_to_end(&mut stdin_raw()).unwrap(); let tables = &Tables::new(); - parallel(mut_dna_seqs(data.as_mut_slice()), |&: seq| reverse_complement(seq, tables)); + parallel(mut_dna_seqs(data.as_mut_slice()), |seq| reverse_complement(seq, tables)); stdout_raw().write(data.as_mut_slice()).unwrap(); } diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/compile-fail/assign-to-method.rs index 0694420e7666f..b8aba7c483db9 100644 --- a/src/test/compile-fail/assign-to-method.rs +++ b/src/test/compile-fail/assign-to-method.rs @@ -27,5 +27,5 @@ fn cat(in_x : usize, in_y : isize) -> cat { fn main() { let nyan : cat = cat(52us, 99); - nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method + nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method } diff --git a/src/test/compile-fail/blind-item-local-shadow.rs b/src/test/compile-fail/blind-item-local-shadow.rs index a28f5f6e55715..5cc087cb66e3c 100644 --- a/src/test/compile-fail/blind-item-local-shadow.rs +++ b/src/test/compile-fail/blind-item-local-shadow.rs @@ -13,7 +13,7 @@ mod bar { } fn main() { - let foo = |&:| false; + let foo = || false; use bar::foo; //~^ ERROR imports are not allowed after non-item statements assert_eq!(foo(), false); diff --git a/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs b/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs index 9b9edce243bb7..9ea5fbbdb1af0 100644 --- a/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/compile-fail/borrowck-call-is-borrow-issue-12224.rs @@ -49,15 +49,15 @@ fn test5(f: &mut Test) { } fn test6() { - let mut f = |&mut:| {}; - (|&mut:| { + let mut f = || {}; + (|| { f(); })(); } fn test7() { fn foo(_: F) where F: FnMut(Box, isize) {} - let mut f = |&mut: g: Box, b: isize| {}; + let mut f = |g: Box, b: isize| {}; f(box |a| { foo(f); //~^ ERROR cannot move `f` into closure because it is borrowed diff --git a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs index 9d73ad319a61c..851b11fac2b9d 100644 --- a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs @@ -23,37 +23,37 @@ fn set(x: &mut isize) { fn a() { let mut x = 3; - let c1 = |&mut:| x = 4; - let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x` + let c1 = || x = 4; + let c2 = || x * 5; //~ ERROR cannot borrow `x` } fn b() { let mut x = 3; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x` + let c1 = || set(&mut x); + let c2 = || get(&x); //~ ERROR cannot borrow `x` } fn c() { let mut x = 3; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x` + let c1 = || set(&mut x); + let c2 = || x * 5; //~ ERROR cannot borrow `x` } fn d() { let mut x = 3; - let c2 = |&mut:| x * 5; + let c2 = || x * 5; x = 5; //~ ERROR cannot assign } fn e() { let mut x = 3; - let c1 = |&mut:| get(&x); + let c1 = || get(&x); x = 5; //~ ERROR cannot assign } fn f() { let mut x = box 3; - let c1 = |&mut:| get(&*x); + let c1 = || get(&*x); *x = 5; //~ ERROR cannot assign } @@ -63,7 +63,7 @@ fn g() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| get(&*x.f); + let c1 = || get(&*x.f); *x.f = 5; //~ ERROR cannot assign to `*x.f` } @@ -73,8 +73,8 @@ fn h() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| get(&*x.f); - let c2 = |&mut:| *x.f = 5; //~ ERROR cannot borrow `x` as mutable + let c1 = || get(&*x.f); + let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable } fn main() { diff --git a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs index 8260774190967..40f9be2dd8230 100644 --- a/src/test/compile-fail/borrowck-closures-mut-of-imm.rs +++ b/src/test/compile-fail/borrowck-closures-mut-of-imm.rs @@ -20,9 +20,9 @@ fn set(x: &mut isize) { } fn a(x: &isize) { - let c1 = |&mut:| set(&mut *x); + let c1 = || set(&mut *x); //~^ ERROR cannot borrow - let c2 = |&mut:| set(&mut *x); + let c2 = || set(&mut *x); //~^ ERROR cannot borrow //~| ERROR closure requires unique access } diff --git a/src/test/compile-fail/borrowck-closures-two-mut.rs b/src/test/compile-fail/borrowck-closures-two-mut.rs index 48a9dccfef0ba..8ab4e257b0626 100644 --- a/src/test/compile-fail/borrowck-closures-two-mut.rs +++ b/src/test/compile-fail/borrowck-closures-two-mut.rs @@ -14,10 +14,12 @@ #![feature(box_syntax)] +fn to_fn_mut(f: F) -> F { f } + fn a() { let mut x = 3; - let c1 = |&mut:| x = 4; - let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once + let c1 = to_fn_mut(|| x = 4); + let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once } fn set(x: &mut isize) { @@ -26,20 +28,20 @@ fn set(x: &mut isize) { fn b() { let mut x = 3; - let c1 = |&mut:| set(&mut x); - let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once + let c1 = to_fn_mut(|| set(&mut x)); + let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once } fn c() { let mut x = 3; - let c1 = |&mut:| x = 5; - let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once + let c1 = to_fn_mut(|| x = 5); + let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once } fn d() { let mut x = 3; - let c1 = |&mut:| x = 5; - let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure) + let c1 = to_fn_mut(|| x = 5); + let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure) //~^ ERROR cannot borrow `x` as mutable more than once } @@ -49,8 +51,8 @@ fn g() { } let mut x = box Foo { f: box 3 }; - let c1 = |&mut:| set(&mut *x.f); - let c2 = |&mut:| set(&mut *x.f); + let c1 = to_fn_mut(|| set(&mut *x.f)); + let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once } diff --git a/src/test/compile-fail/borrowck-closures-unique-imm.rs b/src/test/compile-fail/borrowck-closures-unique-imm.rs index cf86602af0be2..dcf43c01e1775 100644 --- a/src/test/compile-fail/borrowck-closures-unique-imm.rs +++ b/src/test/compile-fail/borrowck-closures-unique-imm.rs @@ -16,7 +16,7 @@ pub fn main() { let mut this = &mut Foo { x: 1, }; - let mut r = |&mut:| { + let mut r = || { let p = &this.x; &mut this.x; //~ ERROR cannot borrow }; diff --git a/src/test/compile-fail/borrowck-closures-unique.rs b/src/test/compile-fail/borrowck-closures-unique.rs index f9a6d5ac84575..9410181659c1a 100644 --- a/src/test/compile-fail/borrowck-closures-unique.rs +++ b/src/test/compile-fail/borrowck-closures-unique.rs @@ -23,27 +23,27 @@ fn set(x: &mut isize) -> isize { } fn a(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| get(x); + let c1 = || get(x); + let c2 = || get(x); } fn b(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` + let c1 = || get(x); + let c2 = || set(x); //~ ERROR closure requires unique access to `x` } fn c(x: &mut isize) { - let c1 = |&mut:| get(x); - let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x` + let c1 = || get(x); + let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` } fn d(x: &mut isize) { - let c1 = |&mut:| set(x); - let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` + let c1 = || set(x); + let c2 = || set(x); //~ ERROR closure requires unique access to `x` } fn e(x: &mut isize) { - let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable + let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable local variable } fn main() { diff --git a/src/test/compile-fail/borrowck-closures-use-after-free.rs b/src/test/compile-fail/borrowck-closures-use-after-free.rs index b6529da18838b..32cd364d1f2d6 100644 --- a/src/test/compile-fail/borrowck-closures-use-after-free.rs +++ b/src/test/compile-fail/borrowck-closures-use-after-free.rs @@ -26,7 +26,7 @@ impl Drop for Foo { fn main() { let mut ptr = box Foo { x: 0 }; - let mut test = |&mut: foo: &Foo| { + let mut test = |foo: &Foo| { ptr = box Foo { x: ptr.x + 1 }; }; test(&*ptr); //~ ERROR cannot borrow `*ptr` diff --git a/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs b/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs index 3c20abab8bdef..5b32fd2d19872 100644 --- a/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs +++ b/src/test/compile-fail/borrowck-init-in-called-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let j = |&:| -> isize { + let j = || -> isize { let i: isize; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/borrowck-init-in-fn-expr.rs b/src/test/compile-fail/borrowck-init-in-fn-expr.rs index 31ca39c3f9b36..65f1a1fa098ae 100644 --- a/src/test/compile-fail/borrowck-init-in-fn-expr.rs +++ b/src/test/compile-fail/borrowck-init-in-fn-expr.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let f = |&:| -> isize { + let f = || -> isize { let i: isize; i //~ ERROR use of possibly uninitialized variable: `i` }; diff --git a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs index c3a1e808e37f8..7093da6803ca5 100644 --- a/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs +++ b/src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs @@ -32,7 +32,7 @@ fn foo() { fn bar() { // Original borrow ends at end of closure - |&:| { + || { let mut x = 1us; let y = &mut x; let z = &mut x; //~ ERROR cannot borrow diff --git a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs index 738755855c070..e59bd62d17854 100644 --- a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs +++ b/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs @@ -14,10 +14,10 @@ fn to_fn_once>(f: F) -> F { f } fn main() { let x = 1; - to_fn_once(move|:| { x = 2; }); + to_fn_once(move|| { x = 2; }); //~^ ERROR: cannot assign to immutable captured outer variable let s = std::old_io::stdin(); - to_fn_once(move|:| { s.read_to_end(); }); + to_fn_once(move|| { s.read_to_end(); }); //~^ ERROR: cannot borrow immutable captured outer variable } diff --git a/src/test/compile-fail/closure-reform-bad.rs b/src/test/compile-fail/closure-reform-bad.rs index ef01c96addeb8..d2295eba6d7a4 100644 --- a/src/test/compile-fail/closure-reform-bad.rs +++ b/src/test/compile-fail/closure-reform-bad.rs @@ -17,7 +17,7 @@ fn call_bare(f: fn(&str)) { fn main() { let string = "world!"; - let f = |&: s: &str| println!("{}{}", s, string); + let f = |s: &str| println!("{}{}", s, string); call_bare(f) //~ ERROR mismatched types } diff --git a/src/test/compile-fail/dead-code-closure-bang.rs b/src/test/compile-fail/dead-code-closure-bang.rs index 46f5f41d7282f..280e2ed095266 100644 --- a/src/test/compile-fail/dead-code-closure-bang.rs +++ b/src/test/compile-fail/dead-code-closure-bang.rs @@ -13,7 +13,7 @@ #![deny(unreachable_code)] fn main() { - let x = |:| panic!(); + let x = || panic!(); x(); std::io::println("Foo bar"); //~ ERROR: unreachable statement } diff --git a/src/test/compile-fail/fn-trait-formatting.rs b/src/test/compile-fail/fn-trait-formatting.rs index f8e7dc11828ff..71e1f7091b2c9 100644 --- a/src/test/compile-fail/fn-trait-formatting.rs +++ b/src/test/compile-fail/fn-trait-formatting.rs @@ -14,20 +14,20 @@ fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { - let _: () = (box |:_: isize| {}) as Box; + let _: () = (box |_: isize| {}) as Box; //~^ ERROR object-safe //~| ERROR mismatched types //~| expected `()` //~| found `Box` //~| expected () //~| found box - let _: () = (box |&:_: isize, isize| {}) as Box; + let _: () = (box |_: isize, isize| {}) as Box; //~^ ERROR mismatched types //~| expected `()` //~| found `Box` //~| expected () //~| found box - let _: () = (box |&mut:| -> isize unimplemented!()) as Box isize>; + let _: () = (box || -> isize unimplemented!()) as Box isize>; //~^ ERROR mismatched types //~| expected `()` //~| found `Box isize>` diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs index 99927d8b9bf55..949c1c0d9c436 100644 --- a/src/test/compile-fail/immut-function-arguments.rs +++ b/src/test/compile-fail/immut-function-arguments.rs @@ -14,7 +14,7 @@ fn f(y: Box) { } fn g() { - let _frob = |&: q: Box| { *q = 2; }; //~ ERROR cannot assign + let _frob = |q: Box| { *q = 2; }; //~ ERROR cannot assign } diff --git a/src/test/compile-fail/issue-10398.rs b/src/test/compile-fail/issue-10398.rs index 5ee693d97a878..736f963012712 100644 --- a/src/test/compile-fail/issue-10398.rs +++ b/src/test/compile-fail/issue-10398.rs @@ -12,7 +12,7 @@ fn main() { let x = box 1; - let f = move|:| { + let f = move|| { let _a = x; drop(x); //~^ ERROR: use of moved value: `x` diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs index 0d7a846bff633..a95bcc73a9c47 100644 --- a/src/test/compile-fail/issue-11192.rs +++ b/src/test/compile-fail/issue-11192.rs @@ -22,7 +22,7 @@ impl Drop for Foo { fn main() { let mut ptr = box Foo { x: 0 }; - let mut test = |&mut: foo: &Foo| { + let mut test = |foo: &Foo| { println!("access {}", foo.x); ptr = box Foo { x: ptr.x + 1 }; println!("access {}", foo.x); diff --git a/src/test/compile-fail/issue-11873.rs b/src/test/compile-fail/issue-11873.rs index f9a523641e41e..38956944f63e6 100644 --- a/src/test/compile-fail/issue-11873.rs +++ b/src/test/compile-fail/issue-11873.rs @@ -10,7 +10,7 @@ fn main() { let mut v = vec!(1); - let mut f = |&mut:| v.push(2); + let mut f = || v.push(2); let _w = v; //~ ERROR: cannot move out of `v` f(); diff --git a/src/test/compile-fail/issue-16939.rs b/src/test/compile-fail/issue-16939.rs index 9d2212b69cee1..7ec3fef5c878e 100644 --- a/src/test/compile-fail/issue-16939.rs +++ b/src/test/compile-fail/issue-16939.rs @@ -14,7 +14,7 @@ // wrong arity. fn _foo (f: F) { - |&: t| f(t); //~ ERROR E0057 + |t| f(t); //~ ERROR E0057 } fn main() {} diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs index 3889b6f4f7dce..b19a7703b8560 100644 --- a/src/test/compile-fail/issue-17551.rs +++ b/src/test/compile-fail/issue-17551.rs @@ -14,5 +14,5 @@ struct B; fn main() { let foo = B; - let closure = |:| foo; //~ ERROR unable to infer enough type information + let closure = || foo; //~ ERROR unable to infer enough type information } diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs index fbecd0487bf6f..1cdf48e291c75 100644 --- a/src/test/compile-fail/issue-17651.rs +++ b/src/test/compile-fail/issue-17651.rs @@ -14,7 +14,7 @@ #![feature(box_syntax)] fn main() { - (|&:| box *[0us].as_slice())(); + (|| box *[0us].as_slice())(); //~^ ERROR cannot move out of borrowed content //~^^ ERROR cannot move a value of type [usize] } diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index 45b7bebfc281e..37dbcaf39bd10 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -20,6 +20,6 @@ impl vec_monad for Vec { } } fn main() { - ["hi"].bind(|&mut: x| [x] ); + ["hi"].bind(|x| [x] ); //~^ ERROR type `[&str; 1]` does not implement any method in scope named `bind` } diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs index c67d6b1ce8f7c..0f7cc2cb72b8e 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/compile-fail/issue-3044.rs @@ -11,7 +11,7 @@ fn main() { let needlesArr: Vec = vec!('a', 'f'); - needlesArr.iter().fold(|&: x, y| { + needlesArr.iter().fold(|x, y| { }); //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied // diff --git a/src/test/compile-fail/issue-3563.rs b/src/test/compile-fail/issue-3563.rs index 7ebc5b7a5b96b..0e1cc18dba910 100644 --- a/src/test/compile-fail/issue-3563.rs +++ b/src/test/compile-fail/issue-3563.rs @@ -10,7 +10,7 @@ trait A { fn a(&self) { - |&:| self.b() + || self.b() //~^ ERROR type `&Self` does not implement any method in scope named `b` //~| ERROR mismatched types //~| expected `()` diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/compile-fail/issue-4335.rs index 3d44c1a52d492..d0da51373d926 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/compile-fail/issue-4335.rs @@ -14,7 +14,7 @@ fn id(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> Box T + 'r> { - id(box |&mut:| *v) //~ ERROR cannot infer + id(box || *v) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/compile-fail/issue-5239-1.rs index 0eaa40efca22b..49a43ee37adca 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/compile-fail/issue-5239-1.rs @@ -11,6 +11,6 @@ // Regression test for issue #5239 fn main() { - let x = |&: ref x: isize| -> isize { x += 1; }; + let x = |ref x: isize| -> isize { x += 1; }; //~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize` } diff --git a/src/test/compile-fail/issue-6801.rs b/src/test/compile-fail/issue-6801.rs index 9424ff22dc75c..9e79701939245 100644 --- a/src/test/compile-fail/issue-6801.rs +++ b/src/test/compile-fail/issue-6801.rs @@ -24,7 +24,7 @@ fn invoke(f: F) where F: FnOnce() -> usize { fn main() { let x : Box = box 9; - let sq = |:| { *x * *x }; + let sq = || { *x * *x }; twice(x); //~ ERROR: cannot move out of invoke(sq); diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index c15c556f5d68f..2d1cea1d44b74 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -25,7 +25,7 @@ impl CrateId { pub fn remove_package_from_database() { let mut lines_to_use: Vec<&CrateId> = Vec::new(); - let push_id = |&mut: installed_id: &CrateId| { + let push_id = |installed_id: &CrateId| { lines_to_use.push(installed_id); //~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to // conflicting requirements diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index ddba7b58afaab..dcc82b8920ff5 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -35,7 +35,7 @@ fn main() { _ => {} } - let x = |&: mut y: isize| 10; //~ ERROR: variable does not need to be mutable + let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable // positive cases @@ -65,7 +65,7 @@ fn main() { _ => {} } - let x = |&mut: mut y: isize| y = 32; + let x = |mut y: isize| y = 32; fn nothing(mut foo: isize) { foo = 37; } // leading underscore should avoid the warning, just like the diff --git a/src/test/compile-fail/refutable-pattern-in-fn-arg.rs b/src/test/compile-fail/refutable-pattern-in-fn-arg.rs index 53f923e506196..be42f0f0ed883 100644 --- a/src/test/compile-fail/refutable-pattern-in-fn-arg.rs +++ b/src/test/compile-fail/refutable-pattern-in-fn-arg.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let f = |&: 3: isize| println!("hello"); + let f = |3: isize| println!("hello"); //~^ ERROR refutable pattern in function argument: `_` not covered f(4); } diff --git a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs index 5b04fa3d87ca5..9f35c636b4526 100644 --- a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs +++ b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs @@ -9,7 +9,7 @@ // except according to those terms. fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { - (|&mut: x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` + (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` } fn main() {} diff --git a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs index cdaa3468a463c..9418156ffcd08 100644 --- a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs +++ b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs @@ -17,7 +17,7 @@ fn main() { { let c = 1; let c_ref = &c; //~ ERROR `c` does not live long enough - f = move |&mut: a: isize, b: isize| { a + b + *c_ref }; + f = move |a: isize, b: isize| { a + b + *c_ref }; } } diff --git a/src/test/compile-fail/regions-addr-of-upvar-self.rs b/src/test/compile-fail/regions-addr-of-upvar-self.rs index fa76ab758ab56..70d5fe83055d3 100644 --- a/src/test/compile-fail/regions-addr-of-upvar-self.rs +++ b/src/test/compile-fail/regions-addr-of-upvar-self.rs @@ -16,7 +16,7 @@ struct dog { impl dog { pub fn chase_cat(&mut self) { - let _f = |&:| { + let _f = || { let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer *p = 3us; }; diff --git a/src/test/compile-fail/regions-escape-unboxed-closure.rs b/src/test/compile-fail/regions-escape-unboxed-closure.rs index 06768fa68804c..abbefd254888b 100644 --- a/src/test/compile-fail/regions-escape-unboxed-closure.rs +++ b/src/test/compile-fail/regions-escape-unboxed-closure.rs @@ -15,5 +15,5 @@ fn with_int(f: &mut FnMut(&isize)) { fn main() { let mut x: Option<&isize> = None; - with_int(&mut |&mut: y| x = Some(y)); //~ ERROR cannot infer + with_int(&mut |y| x = Some(y)); //~ ERROR cannot infer } diff --git a/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs b/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs index 21586f78db342..2e3531a2e8f26 100644 --- a/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs +++ b/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs @@ -16,7 +16,7 @@ fn main() { // Unboxed closure case { let mut x = 0us; - let mut f = |&mut:| &mut x; //~ ERROR cannot infer + let mut f = || &mut x; //~ ERROR cannot infer let x = f(); let y = f(); } diff --git a/src/test/compile-fail/unboxed-closure-immutable-capture.rs b/src/test/compile-fail/unboxed-closure-immutable-capture.rs index ebdd3c3107f3f..145b2bfaeddfd 100644 --- a/src/test/compile-fail/unboxed-closure-immutable-capture.rs +++ b/src/test/compile-fail/unboxed-closure-immutable-capture.rs @@ -18,14 +18,14 @@ fn set(x: &mut usize) { *x = 0; } fn main() { let x = 0us; - move |&mut:| x = 1; //~ ERROR cannot assign - move |&mut:| set(&mut x); //~ ERROR cannot borrow - move |:| x = 1; //~ ERROR cannot assign - move |:| set(&mut x); //~ ERROR cannot borrow - |&mut:| x = 1; //~ ERROR cannot assign + move || x = 1; //~ ERROR cannot assign + move || set(&mut x); //~ ERROR cannot borrow + move || x = 1; //~ ERROR cannot assign + move || set(&mut x); //~ ERROR cannot borrow + || x = 1; //~ ERROR cannot assign // FIXME: this should be `cannot borrow` (issue #18330) - |&mut:| set(&mut x); //~ ERROR cannot assign - |:| x = 1; //~ ERROR cannot assign + || set(&mut x); //~ ERROR cannot assign + || x = 1; //~ ERROR cannot assign // FIXME: this should be `cannot borrow` (issue #18330) - |:| set(&mut x); //~ ERROR cannot assign + || set(&mut x); //~ ERROR cannot assign } diff --git a/src/test/compile-fail/unboxed-closure-region.rs b/src/test/compile-fail/unboxed-closure-region.rs index 9d9667986949e..98ac54de8ad78 100644 --- a/src/test/compile-fail/unboxed-closure-region.rs +++ b/src/test/compile-fail/unboxed-closure-region.rs @@ -15,6 +15,6 @@ fn main() { let _f = { let x = 0us; - |:| x //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements + || x //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements }; } diff --git a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs b/src/test/compile-fail/unboxed-closures-borrow-conflict.rs index bb92e57d70c0e..0bdc261e8c88d 100644 --- a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs +++ b/src/test/compile-fail/unboxed-closures-borrow-conflict.rs @@ -15,6 +15,6 @@ fn main() { let mut x = 0us; - let f = |:| x += 1; + let f = || x += 1; let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed } diff --git a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs index ef6c439aeb89d..3dd5779914d06 100644 --- a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -23,7 +23,7 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0, &|&: x, y| { + doit(0, &|x, y| { x.set(y); //~ ERROR cannot infer }); } diff --git a/src/test/compile-fail/unboxed-closures-type-mismatch.rs b/src/test/compile-fail/unboxed-closures-type-mismatch.rs index f7ac2274ffb3a..e1192b22485c6 100644 --- a/src/test/compile-fail/unboxed-closures-type-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-type-mismatch.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; pub fn main() { - let mut f = |&mut: x: isize, y: isize| -> isize { x + y }; + let mut f = |x: isize, y: isize| -> isize { x + y }; let z = f(1us, 2); //~ ERROR mismatched types println!("{}", z); } diff --git a/src/test/compile-fail/unused-mut-warning-captured-var.rs b/src/test/compile-fail/unused-mut-warning-captured-var.rs index 87ea56c055350..d4dc58864ad82 100644 --- a/src/test/compile-fail/unused-mut-warning-captured-var.rs +++ b/src/test/compile-fail/unused-mut-warning-captured-var.rs @@ -13,5 +13,5 @@ fn main() { let mut x = 1; //~^ ERROR: variable does not need to be mutable - move|:| { println!("{}", x); }; + move|| { println!("{}", x); }; } diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs index 59428a2c06f52..ea684b1d69c52 100644 --- a/src/test/debuginfo/closure-in-generic-function.rs +++ b/src/test/debuginfo/closure-in-generic-function.rs @@ -51,7 +51,7 @@ fn some_generic_fun(a: T1, b: T2) -> (T2, T1) { - let closure = |&: x, y| { + let closure = |x, y| { zzz(); // #break (y, x) }; diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index 5e04c81cefd76..fb4378d5e8bec 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -18,7 +18,7 @@ // Nothing to do here really, just make sure it compiles. See issue #8513. fn main() { - let _ = |&:|(); + let _ = ||(); let _ = (1u..3).map(|_| 5); } diff --git a/src/test/debuginfo/lexical-scope-in-stack-closure.rs b/src/test/debuginfo/lexical-scope-in-stack-closure.rs index f2d092216697f..6cb1218c1233a 100644 --- a/src/test/debuginfo/lexical-scope-in-stack-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-stack-closure.rs @@ -79,7 +79,7 @@ fn main() { zzz(); // #break sentinel(); - let closure = |&: x: int| { + let closure = |x: int| { zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-unique-closure.rs b/src/test/debuginfo/lexical-scope-in-unique-closure.rs index be4085b63abe5..ba660deeca01a 100644 --- a/src/test/debuginfo/lexical-scope-in-unique-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-unique-closure.rs @@ -80,7 +80,7 @@ fn main() { zzz(); // #break sentinel(); - let unique_closure = |: x:int| { + let unique_closure = |x:int| { zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/multi-byte-chars.rs b/src/test/debuginfo/multi-byte-chars.rs index cb7e26327c3de..dd0d86bf742e6 100644 --- a/src/test/debuginfo/multi-byte-chars.rs +++ b/src/test/debuginfo/multi-byte-chars.rs @@ -24,5 +24,5 @@ struct C { θ: u8 } fn main() { let x = C { θ: 0 }; - (|&: c: C| c.θ )(x); + (|c: C| c.θ )(x); } diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 24b6df4e8f142..e41c69fa65dba 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -322,8 +322,8 @@ fn main() { // how that maps to rustc's internal representation of these forms. // Once closures have reached their 1.0 form, the tests below should // probably be expanded. - let closure1 = (|&: x:isize| {}, 0u); - let closure2 = (|&: x:i8, y: f32| { (x as f32) + y }, 0u); + let closure1 = (|x:isize| {}, 0u); + let closure2 = (|x:i8, y: f32| { (x as f32) + y }, 0u); zzz(); // #break } diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index d7831c983c050..512df3605bfcd 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -101,10 +101,10 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let mut closure = |&mut:| { + let mut closure = || { let closure_local = 8; - let mut nested_closure = |&mut:| { + let mut nested_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned + closure_local; }; diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index 30a07ea46ddd3..b07c8ffde7f8f 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -61,7 +61,7 @@ fn main() { let owned = box 5; - let closure = move |:| { + let closure = move || { zzz(); // #break do_something(&constant, &a_struct.a, &*owned); }; @@ -73,7 +73,7 @@ fn main() { // The `self` argument of the following closure should be passed by value // to FnOnce::call_once(self, args), which gets translated a bit differently // than the regular case. Let's make sure this is supported too. - let immedate_env = move |:| { + let immedate_env = move || { zzz(); // #break return constant2; }; diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index 9daf6abba1143..ee706c13634f0 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -94,7 +94,7 @@ fn main() { let owned = box 6; { - let mut first_closure = |&mut:| { + let mut first_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned; }; @@ -103,7 +103,7 @@ fn main() { } { - let mut second_closure = |&mut:| { + let mut second_closure = || { zzz(); // #break variable = constant + a_struct.a + struct_ref.a + *owned; }; diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index cb3b3d9af38b2..25f7c64b5ab82 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -269,7 +269,7 @@ fn hello((z, a) : (u32, String), ex: X) { s4.provided_method(); s2.prov(45); - let closure = |&: x: u32, s: &SomeTrait| { + let closure = |x: u32, s: &SomeTrait| { s.Method(23); return x + y; }; diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index fe52b1a693cdc..f3c874a5afcec 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -13,6 +13,6 @@ fn force(f: F) -> int where F: FnOnce() -> int { return f(); } pub fn main() { fn f() -> int { return 7; } assert_eq!(force(f), 7); - let g = {|&:|force(f)}; + let g = {||force(f)}; assert_eq!(g(), 7); } diff --git a/src/test/run-pass/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck-closures-two-imm.rs index df8dbdd03c740..c907778339ec5 100644 --- a/src/test/run-pass/borrowck-closures-two-imm.rs +++ b/src/test/run-pass/borrowck-closures-two-imm.rs @@ -17,8 +17,8 @@ fn a() -> i32 { let mut x = 3i32; x += 1; - let c1 = |&:| x * 4; - let c2 = |&:| x * 5; + let c1 = || x * 4; + let c2 = || x * 5; c1() * c2() * x } @@ -29,16 +29,16 @@ fn get(x: &i32) -> i32 { fn b() -> i32 { let mut x = 3i32; x += 1; - let c1 = |&:| get(&x); - let c2 = |&:| get(&x); + let c1 = || get(&x); + let c2 = || get(&x); c1() * c2() * x } fn c() -> i32 { let mut x = 3i32; x += 1; - let c1 = |&:| x * 5; - let c2 = |&:| get(&x); + let c1 = || x * 5; + let c2 = || get(&x); c1() * c2() * x } diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs index 773780ffb0953..1be57674fa1ff 100644 --- a/src/test/run-pass/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs @@ -14,7 +14,7 @@ pub fn main() { let bar = box 3; - let h = |:| -> int *bar; + let h = || -> int *bar; assert_eq!(h(), 3); } diff --git a/src/test/run-pass/capture-clauses-unboxed-closures.rs b/src/test/run-pass/capture-clauses-unboxed-closures.rs index de1196e10d88c..ca315b7a9f1db 100644 --- a/src/test/run-pass/capture-clauses-unboxed-closures.rs +++ b/src/test/run-pass/capture-clauses-unboxed-closures.rs @@ -19,6 +19,6 @@ fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { fn main() { let mut sum = 0u; let elems = [ 1u, 2, 3, 4, 5 ]; - each(&elems, |&mut: val: &uint| sum += *val); + each(&elems, |val: &uint| sum += *val); assert_eq!(sum, 15); } diff --git a/src/test/run-pass/closure-inference2.rs b/src/test/run-pass/closure-inference2.rs index c0877568b72aa..fa16ea001452c 100644 --- a/src/test/run-pass/closure-inference2.rs +++ b/src/test/run-pass/closure-inference2.rs @@ -11,7 +11,7 @@ // Test a rather underspecified example: pub fn main() { - let f = {|&: i| i}; + let f = {|i| i}; assert_eq!(f(2), 2); assert_eq!(f(5), 5); } diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs index 6557594594565..95af729e5e165 100644 --- a/src/test/run-pass/empty-tag.rs +++ b/src/test/run-pass/empty-tag.rs @@ -23,6 +23,6 @@ fn wrapper3(i: chan) { } pub fn main() { - let wrapped = {|&:|wrapper3(chan::chan_t)}; + let wrapped = {||wrapper3(chan::chan_t)}; wrapped(); } diff --git a/src/test/run-pass/fn-pattern-expected-type.rs b/src/test/run-pass/fn-pattern-expected-type.rs index 24bf1f94d887b..3e81ca5125ba4 100644 --- a/src/test/run-pass/fn-pattern-expected-type.rs +++ b/src/test/run-pass/fn-pattern-expected-type.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let f = |&: (x, y): (int, int)| { + let f = |(x, y): (int, int)| { assert_eq!(x, 1); assert_eq!(y, 2); }; diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs index 785abbe449bb4..34417891197a4 100644 --- a/src/test/run-pass/fn-type-infer.rs +++ b/src/test/run-pass/fn-type-infer.rs @@ -12,7 +12,7 @@ pub fn main() { // We should be able to type infer inside of ||s. - let _f = |&:| { + let _f = || { let i = 10; }; } diff --git a/src/test/run-pass/hrtb-precedence-of-plus.rs b/src/test/run-pass/hrtb-precedence-of-plus.rs index 1d1e744ef0802..b59e7b67d4edd 100644 --- a/src/test/run-pass/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/hrtb-precedence-of-plus.rs @@ -17,7 +17,7 @@ // cause a compilation error. Issue #18772. fn adder(y: int) -> Box int + 'static> { - box move |&: x| y + x + box move |x| y + x } fn main() {} diff --git a/src/test/run-pass/hrtb-unboxed-closure-trait.rs b/src/test/run-pass/hrtb-unboxed-closure-trait.rs index fea628177da41..c34e1a4862f82 100644 --- a/src/test/run-pass/hrtb-unboxed-closure-trait.rs +++ b/src/test/run-pass/hrtb-unboxed-closure-trait.rs @@ -18,5 +18,5 @@ fn foo(f: F) { } fn main() { - foo(|&: x: &int| println!("{}", *x)); + foo(|x: &int| println!("{}", *x)); } diff --git a/src/test/run-pass/issue-10718.rs b/src/test/run-pass/issue-10718.rs index 71b4cbe933427..c3ec3fc40e30a 100644 --- a/src/test/run-pass/issue-10718.rs +++ b/src/test/run-pass/issue-10718.rs @@ -15,6 +15,6 @@ fn f(p: F) { } pub fn main() { - let p = |:| (); + let p = || (); f(p); } diff --git a/src/test/run-pass/issue-13434.rs b/src/test/run-pass/issue-13434.rs index 953701441256a..5d7a84d80d4c3 100644 --- a/src/test/run-pass/issue-13434.rs +++ b/src/test/run-pass/issue-13434.rs @@ -26,5 +26,5 @@ fn do_stuff(r: R) -> String { } pub fn main() { - assert_eq!("MyStruct".to_string(), do_stuff(|: s: MyStruct| format!("{:?}", s))); + assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); } diff --git a/src/test/run-pass/issue-1460.rs b/src/test/run-pass/issue-1460.rs index e7516639db0c3..44465fe5f80ee 100644 --- a/src/test/run-pass/issue-1460.rs +++ b/src/test/run-pass/issue-1460.rs @@ -10,5 +10,5 @@ pub fn main() { - {|&: i| if 1 == i { }}; + {|i| if 1 == i { }}; } diff --git a/src/test/run-pass/issue-14919.rs b/src/test/run-pass/issue-14919.rs index 4d05b98147bd6..933e7e40f06d3 100644 --- a/src/test/run-pass/issue-14919.rs +++ b/src/test/run-pass/issue-14919.rs @@ -58,6 +58,6 @@ fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndi fn main() { let s = "abcbdef"; - match_indices(s, |&mut: c: char| c == 'b') + match_indices(s, |c: char| c == 'b') .collect::>(); } diff --git a/src/test/run-pass/issue-15571.rs b/src/test/run-pass/issue-15571.rs index 7d53b6729516d..ab9554f65d4c8 100644 --- a/src/test/run-pass/issue-15571.rs +++ b/src/test/run-pass/issue-15571.rs @@ -48,7 +48,7 @@ fn match_on_binding() { fn match_on_upvar() { let mut foo = Some(box 8i32); - let f = move|:| { + let f = move|| { match foo { None => {}, Some(x) => { diff --git a/src/test/run-pass/issue-16256.rs b/src/test/run-pass/issue-16256.rs index e7422e233a629..48ea3a93296e3 100644 --- a/src/test/run-pass/issue-16256.rs +++ b/src/test/run-pass/issue-16256.rs @@ -10,5 +10,5 @@ fn main() { let mut buf = Vec::new(); - |&mut: c: u8| buf.push(c); + |c: u8| buf.push(c); } diff --git a/src/test/run-pass/issue-16560.rs b/src/test/run-pass/issue-16560.rs index 6b03a499f1577..ca40b2fe4c7d0 100644 --- a/src/test/run-pass/issue-16560.rs +++ b/src/test/run-pass/issue-16560.rs @@ -15,7 +15,7 @@ use std::mem; fn main() { let y = 0u8; - let closure = move |&: x| y + x; + let closure = move |x| y + x; // Check that both closures are capturing by value assert_eq!(1, mem::size_of_val(&closure)); diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index 95b7728b47f99..daf09047bef72 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -21,7 +21,7 @@ struct Parser<'a, I, O> { impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { Parser { - parse: box move |&mut: x: I| { + parse: box move |x: I| { match (self.parse)(x) { Ok(r) => (rhs.parse)(r), Err(e) => Err(e) diff --git a/src/test/run-pass/issue-16774.rs b/src/test/run-pass/issue-16774.rs index d426f82f89fc9..cc427dd941b73 100644 --- a/src/test/run-pass/issue-16774.rs +++ b/src/test/run-pass/issue-16774.rs @@ -47,7 +47,7 @@ fn main() { { let mut test = X(box 5); { - let mut change = |&mut:| { *test = 10 }; + let mut change = || { *test = 10 }; change(); } assert_eq!(*test, 10); diff --git a/src/test/run-pass/issue-17816.rs b/src/test/run-pass/issue-17816.rs index d9d2c771390fd..f8fbd680dcb9e 100644 --- a/src/test/run-pass/issue-17816.rs +++ b/src/test/run-pass/issue-17816.rs @@ -12,7 +12,7 @@ fn main() { struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F } - let f = |&: x: Vec<&str>| -> &str "foobar"; + let f = |x: Vec<&str>| -> &str "foobar"; let sym = Symbol { function: f }; (sym.function)(vec![]); } diff --git a/src/test/run-pass/issue-17897.rs b/src/test/run-pass/issue-17897.rs index da6c83142eab6..3774aaa190333 100644 --- a/src/test/run-pass/issue-17897.rs +++ b/src/test/run-pass/issue-17897.rs @@ -17,5 +17,5 @@ fn action(cb: Thunk) -> uint { } pub fn main() { - println!("num: {}", action(Thunk::with_arg(move |:u| u))); + println!("num: {}", action(Thunk::with_arg(move |u| u))); } diff --git a/src/test/run-pass/issue-18188.rs b/src/test/run-pass/issue-18188.rs index a2152db6884ac..7a5a86822afda 100644 --- a/src/test/run-pass/issue-18188.rs +++ b/src/test/run-pass/issue-18188.rs @@ -20,7 +20,7 @@ pub fn propagate(action: F) -> Thunk, Result> E: Promisable + Clone, F: FnOnce(&T) -> Result + Send, G: FnOnce(Result) -> Result { - Thunk::with_arg(move |: result: Result| { + Thunk::with_arg(move |result: Result| { match result { Ok(ref t) => action(t), Err(ref e) => Err(e.clone()), diff --git a/src/test/run-pass/issue-18652.rs b/src/test/run-pass/issue-18652.rs index ef2c15c748ca3..8f560258d9f47 100644 --- a/src/test/run-pass/issue-18652.rs +++ b/src/test/run-pass/issue-18652.rs @@ -17,5 +17,5 @@ fn main() { let x = 2u8; let y = 3u8; - assert_eq!((move |:| x + y)(), 5); + assert_eq!((move || x + y)(), 5); } diff --git a/src/test/run-pass/issue-18661.rs b/src/test/run-pass/issue-18661.rs index 6a2f73a787a48..bb2907241c2c6 100644 --- a/src/test/run-pass/issue-18661.rs +++ b/src/test/run-pass/issue-18661.rs @@ -20,7 +20,7 @@ pub fn inside(c: F) { // Use different number of type parameters and closure type to trigger // an obvious ICE when param environments are mixed up pub fn outside() { - inside(|&:| {}); + inside(|| {}); } fn main() { diff --git a/src/test/run-pass/issue-18685.rs b/src/test/run-pass/issue-18685.rs index be6dd583132ec..698b61e5759ad 100644 --- a/src/test/run-pass/issue-18685.rs +++ b/src/test/run-pass/issue-18685.rs @@ -17,7 +17,7 @@ trait Tr { fn foo(&self); fn bar(&self) { - (|:| { self.foo() })() + (|| { self.foo() })() } } diff --git a/src/test/run-pass/issue-18711.rs b/src/test/run-pass/issue-18711.rs index 6a04e68af0cb3..0338a4eff2238 100644 --- a/src/test/run-pass/issue-18711.rs +++ b/src/test/run-pass/issue-18711.rs @@ -17,5 +17,5 @@ extern crate "issue-18711" as issue; fn main() { - (|:| issue::inner(()))(); + (|| issue::inner(()))(); } diff --git a/src/test/run-pass/issue-19135.rs b/src/test/run-pass/issue-19135.rs index 9557d7e4fa816..031a63ba474c1 100644 --- a/src/test/run-pass/issue-19135.rs +++ b/src/test/run-pass/issue-19135.rs @@ -14,7 +14,7 @@ struct LifetimeStruct<'a>; fn main() { - takes_hrtb_closure(|&mut: lts| println!("{:?}", lts)); + takes_hrtb_closure(|lts| println!("{:?}", lts)); } fn takes_hrtb_closureFnMut(LifetimeStruct<'a>)>(mut f: F) { diff --git a/src/test/run-pass/issue-2074.rs b/src/test/run-pass/issue-2074.rs index 120ada96c15b7..5f2805ed35455 100644 --- a/src/test/run-pass/issue-2074.rs +++ b/src/test/run-pass/issue-2074.rs @@ -11,11 +11,11 @@ #![allow(non_camel_case_types)] pub fn main() { - let one = |&:| { + let one = || { enum r { a }; r::a as uint }; - let two = |&:| { + let two = || { enum r { a }; r::a as uint }; diff --git a/src/test/run-pass/issue-21306.rs b/src/test/run-pass/issue-21306.rs index c75abd8896343..ca2a4e546b7c8 100644 --- a/src/test/run-pass/issue-21306.rs +++ b/src/test/run-pass/issue-21306.rs @@ -12,6 +12,6 @@ use std::sync::Arc; fn main() { let x = 5us; - let command = Arc::new(Box::new(|&:| { x*2 })); + let command = Arc::new(Box::new(|| { x*2 })); assert_eq!(command(), 10); } diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs index c08bdf5440812..3e7deee6ec107 100644 --- a/src/test/run-pass/issue-3052.rs +++ b/src/test/run-pass/issue-3052.rs @@ -14,7 +14,7 @@ type Connection = Box) + 'static>; fn f() -> Option { - let mock_connection: Connection = box |&mut: _| {}; + let mock_connection: Connection = box |_| {}; Some(mock_connection) } diff --git a/src/test/run-pass/issue-3429.rs b/src/test/run-pass/issue-3429.rs index 60c5345000436..6fc8c9c6843ee 100644 --- a/src/test/run-pass/issue-3429.rs +++ b/src/test/run-pass/issue-3429.rs @@ -10,6 +10,6 @@ pub fn main() { let x = 1u; - let y = |&:| x; + let y = || x; let _z = y(); } diff --git a/src/test/run-pass/issue-5239-2.rs b/src/test/run-pass/issue-5239-2.rs index 69255c576811f..dd9a6fb35439e 100644 --- a/src/test/run-pass/issue-5239-2.rs +++ b/src/test/run-pass/issue-5239-2.rs @@ -11,7 +11,7 @@ // Regression test for issue #5239 pub fn main() { - let _f = |&: ref x: int| { *x }; + let _f = |ref x: int| { *x }; let foo = 10; assert!(_f(foo) == 10); } diff --git a/src/test/run-pass/issue-6157.rs b/src/test/run-pass/issue-6157.rs index 07c7c6888e1eb..39f387afaba04 100644 --- a/src/test/run-pass/issue-6157.rs +++ b/src/test/run-pass/issue-6157.rs @@ -21,7 +21,7 @@ fn squarei<'a>(x: int, op: &'a mut OpInt) -> int { op.call(x, x) } fn muli(x:int, y:int) -> int { x * y } pub fn main() { - let mut f = |&mut: x, y| muli(x, y); + let mut f = |x, y| muli(x, y); { let g = &mut f; let h = g as &mut OpInt; diff --git a/src/test/run-pass/issue-868.rs b/src/test/run-pass/issue-868.rs index b2ccc092358e2..e47999fc46860 100644 --- a/src/test/run-pass/issue-868.rs +++ b/src/test/run-pass/issue-868.rs @@ -20,5 +20,5 @@ pub fn main() { let _: () = f(| | { }); // empty block with no type info should compile too let _ = f(||{}); - let _ = (|&:|{}); + let _ = (||{}); } diff --git a/src/test/run-pass/issue-9129.rs b/src/test/run-pass/issue-9129.rs index 2ef1c1d264a40..6c843993040f3 100644 --- a/src/test/run-pass/issue-9129.rs +++ b/src/test/run-pass/issue-9129.rs @@ -29,7 +29,7 @@ fn Ident_new() -> Ident { pub fn light_fuse(fld: Box) { int3!(); - let f = |&:| { + let f = || { int3!(); fld.boom(Ident_new()); // *** 1 }; diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index b33e6512b18bd..009dc562d56fc 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -16,7 +16,7 @@ struct Refs { refs: Vec , n: int } pub fn main() { let mut e = Refs{refs: vec!(), n: 0}; - let _f = |&:| println!("{}", e.n); + let _f = || println!("{}", e.n); let x: &[int] = e.refs.as_slice(); assert_eq!(x.len(), 0); } diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index 0cd8c13a4e10a..4231e5dba9f0f 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -19,7 +19,8 @@ struct A { a: Box } fn foo() -> Box isize + 'static> { let k = box 22; let _u = A {a: k.clone()}; - let result = |&mut:| 22; + // FIXME(#16640) suffix in `22i` suffix shouldn't be necessary + let result = || 22i; box result } diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs index 388b814b2af10..b1f7da17c8f80 100644 --- a/src/test/run-pass/mut-function-arguments.rs +++ b/src/test/run-pass/mut-function-arguments.rs @@ -17,7 +17,7 @@ fn f(mut y: Box) { } fn g() { - let frob = |&: mut q: Box| { *q = 2; assert!(*q == 2); }; + let frob = |mut q: Box| { *q = 2; assert!(*q == 2); }; let w = box 37; frob(w); diff --git a/src/test/run-pass/mut-in-ident-patterns.rs b/src/test/run-pass/mut-in-ident-patterns.rs index 8be200d3bf32c..d3ae80861f231 100644 --- a/src/test/run-pass/mut-in-ident-patterns.rs +++ b/src/test/run-pass/mut-in-ident-patterns.rs @@ -75,6 +75,6 @@ pub fn main() { x = 30; assert_eq!(x, 30); - (|&: A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); + (|A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); } diff --git a/src/test/run-pass/pattern-in-closure.rs b/src/test/run-pass/pattern-in-closure.rs index c718b948f8dc0..e4f1df2d6376d 100644 --- a/src/test/run-pass/pattern-in-closure.rs +++ b/src/test/run-pass/pattern-in-closure.rs @@ -14,8 +14,8 @@ struct Foo { } pub fn main() { - let f = |&: (x, _): (int, int)| println!("{}", x + 1); - let g = |&: Foo { x: x, y: _y }: Foo| println!("{}", x + 1); + let f = |(x, _): (int, int)| println!("{}", x + 1); + let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1); f((2, 3)); g(Foo { x: 1, y: 2 }); } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index dc6f377e9b279..6ebef9f34ad66 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -24,7 +24,7 @@ pub fn main() { let mut i = 3i32; assert_eq!(i, 3); { - let cl = |&mut:| i += 1; + let cl = || i += 1; let mut cl_box = box_it(box cl); cl_box.cl.call_mut(()); } diff --git a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs index c4852c9162cab..a2b6d569ac9a7 100644 --- a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs @@ -28,14 +28,14 @@ pub fn main() { fn explicit() { fn test(_x: Option>) where F: FnMut(Box FnMut(&'a int)>) {} - test(Some(box |&mut: _f: Box FnMut(&'a int)>| {})); + test(Some(box |_f: Box FnMut(&'a int)>| {})); } // The code below is shorthand for the code above (and more likely // to represent what one encounters in practice). fn implicit() { fn test(_x: Option>) where F: FnMut(Box< FnMut(& int)>) {} - test(Some(box |&mut: _f: Box< FnMut(& int)>| {})); + test(Some(box |_f: Box< FnMut(& int)>| {})); } explicit(); diff --git a/src/test/run-pass/regions-static-closure.rs b/src/test/run-pass/regions-static-closure.rs index abd5789bb1f76..7198c35944f9a 100644 --- a/src/test/run-pass/regions-static-closure.rs +++ b/src/test/run-pass/regions-static-closure.rs @@ -25,6 +25,6 @@ fn call_static_closure(mut cl: closure_box<'static>) { } pub fn main() { - let cl_box = box_it(box |&mut:| println!("Hello, world!")); + let cl_box = box_it(box || println!("Hello, world!")); call_static_closure(cl_box); } diff --git a/src/test/run-pass/return-from-closure.rs b/src/test/run-pass/return-from-closure.rs index 899dc8ddbe90d..60856ee60425b 100644 --- a/src/test/run-pass/return-from-closure.rs +++ b/src/test/run-pass/return-from-closure.rs @@ -13,7 +13,7 @@ static mut calls: uint = 0; fn surrounding() { - let return_works = |&: n: int| { + let return_works = |n: int| { unsafe { calls += 1 } if n >= 0 { return; } @@ -23,7 +23,7 @@ fn surrounding() { return_works(10); return_works(20); - let return_works_proc = |: n: int| { + let return_works_proc = |n: int| { unsafe { calls += 1 } if n >= 0 { return; } diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index 89624c3ac16a3..6c9707103b9bb 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -21,7 +21,7 @@ fn test05_start(f: F) { fn test05() { let three = box 3; - let fn_to_send = move|: n:int| { + let fn_to_send = move|n:int| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); }; diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index 6695920723aef..4df1ff1481042 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -37,7 +37,7 @@ fn test_tempdir() { fn test_rm_tempdir() { let (tx, rx) = channel(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = TempDir::new("test_rm_tempdir").unwrap(); tx.send(tmp.path().clone()).unwrap(); panic!("panic to unwind past `tmp`"); @@ -48,7 +48,7 @@ fn test_rm_tempdir() { let tmp = TempDir::new("test_rm_tempdir").unwrap(); let path = tmp.path().clone(); - let f = move|:| -> () { + let f = move|| -> () { let _tmp = tmp; panic!("panic to unwind past `tmp`"); }; @@ -57,10 +57,11 @@ fn test_rm_tempdir() { let path; { - let f = move|:| { + let f = move || { TempDir::new("test_rm_tempdir").unwrap() }; - let tmp = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); + // FIXME(#16640) `: TempDir` annotation shouldn't be necessary + let tmp: TempDir = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); path = tmp.path().clone(); assert!(path.exists()); } @@ -78,7 +79,7 @@ fn test_rm_tempdir() { fn test_rm_tempdir_close() { let (tx, rx) = channel(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = TempDir::new("test_rm_tempdir").unwrap(); tx.send(tmp.path().clone()).unwrap(); tmp.close(); @@ -90,7 +91,7 @@ fn test_rm_tempdir_close() { let tmp = TempDir::new("test_rm_tempdir").unwrap(); let path = tmp.path().clone(); - let f = move|:| -> () { + let f = move|| -> () { let tmp = tmp; tmp.close(); panic!("panic when unwinding past `tmp`"); @@ -100,10 +101,11 @@ fn test_rm_tempdir_close() { let path; { - let f = move|:| { + let f = move || { TempDir::new("test_rm_tempdir").unwrap() }; - let tmp = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); + // FIXME(#16640) `: TempDir` annotation shouldn't be necessary + let tmp: TempDir = Thread::scoped(f).join().ok().expect("test_rm_tmdir"); path = tmp.path().clone(); assert!(path.exists()); tmp.close(); diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs index b114391a36db0..d33ebeadba86e 100644 --- a/src/test/run-pass/type-id-higher-rank.rs +++ b/src/test/run-pass/type-id-higher-rank.rs @@ -56,8 +56,8 @@ fn main() { // Note that every unboxed closure has its own anonymous type, // so no two IDs should equal each other, even when compatible { - let a = id(|&: _: &int, _: &int| {}); - let b = id(|&: _: &int, _: &int| {}); + let a = id(|_: &int, _: &int| {}); + let b = id(|_: &int, _: &int| {}); assert!(a != b); } diff --git a/src/test/run-pass/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures-all-traits.rs index 635e1670aada1..7e71e1da462fd 100644 --- a/src/test/run-pass/unboxed-closures-all-traits.rs +++ b/src/test/run-pass/unboxed-closures-all-traits.rs @@ -24,8 +24,8 @@ fn c int>(f: F) -> int { fn main() { let z: int = 7; - assert_eq!(a(move |&: x: int, y| x + y + z), 10); - assert_eq!(b(move |&mut: x: int, y| x + y + z), 14); - assert_eq!(c(move |: x: int, y| x + y + z), 18); + assert_eq!(a(move |x: int, y| x + y + z), 10); + assert_eq!(b(move |x: int, y| x + y + z), 14); + assert_eq!(c(move |x: int, y| x + y + z), 18); } diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs index 27528ca5d5663..d515ccf2ec0a5 100644 --- a/src/test/run-pass/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures-boxed.rs @@ -15,7 +15,7 @@ use std::ops::FnMut; fn make_adder(x: i32) -> Boxi32+'static> { - (box move |&mut: y: i32| -> i32 { x + y }) as + (box move |y: i32| -> i32 { x + y }) as Boxi32+'static> } diff --git a/src/test/run-pass/unboxed-closures-by-ref.rs b/src/test/run-pass/unboxed-closures-by-ref.rs index be955486dac33..f1435b43f8017 100644 --- a/src/test/run-pass/unboxed-closures-by-ref.rs +++ b/src/test/run-pass/unboxed-closures-by-ref.rs @@ -28,8 +28,8 @@ fn main() { let mut x = 0u; let y = 2u; - call_fn(|&:| assert_eq!(x, 0)); - call_fn_mut(|&mut:| x += y); - call_fn_once(|:| x += y); + call_fn(|| assert_eq!(x, 0)); + call_fn_mut(|| x += y); + call_fn_once(|| x += y); assert_eq!(x, y * 2); } diff --git a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs index 2854d64f6637b..0c49c81517086 100644 --- a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] fn main() { - let mut unboxed = |&mut:| {}; + let mut unboxed = || {}; unboxed(); } diff --git a/src/test/run-pass/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures-drop.rs index 8d4d7b4ecb503..f4a24c17e6e99 100644 --- a/src/test/run-pass/unboxed-closures-drop.rs +++ b/src/test/run-pass/unboxed-closures-drop.rs @@ -55,13 +55,13 @@ fn c int>(f: F) -> int { fn test_fn() { { - a(move |&: a: int, b| { a + b }); + a(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 0); { let z = &Droppable::new(); - a(move |&: a: int, b| { z; a + b }); + a(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 0); } assert_eq!(drop_count(), 1); @@ -69,7 +69,7 @@ fn test_fn() { { let z = &Droppable::new(); let zz = &Droppable::new(); - a(move |&: a: int, b| { z; zz; a + b }); + a(move |a: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 1); } assert_eq!(drop_count(), 3); @@ -77,13 +77,13 @@ fn test_fn() { fn test_fn_mut() { { - b(move |&mut: a: int, b| { a + b }); + b(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 3); { let z = &Droppable::new(); - b(move |&mut: a: int, b| { z; a + b }); + b(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 3); } assert_eq!(drop_count(), 4); @@ -91,7 +91,7 @@ fn test_fn_mut() { { let z = &Droppable::new(); let zz = &Droppable::new(); - b(move |&mut: a: int, b| { z; zz; a + b }); + b(move |a: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 4); } assert_eq!(drop_count(), 6); @@ -99,13 +99,13 @@ fn test_fn_mut() { fn test_fn_once() { { - c(move |: a: int, b| { a + b }); + c(move |a: int, b| { a + b }); } assert_eq!(drop_count(), 6); { let z = Droppable::new(); - c(move |: a: int, b| { z; a + b }); + c(move |a: int, b| { z; a + b }); assert_eq!(drop_count(), 7); } assert_eq!(drop_count(), 7); @@ -113,7 +113,7 @@ fn test_fn_once() { { let z = Droppable::new(); let zz = Droppable::new(); - c(move |: a: int, b| { z; zz; a + b }); + c(move |a: int, b| { z; zz; a + b }); assert_eq!(drop_count(), 9); } assert_eq!(drop_count(), 9); diff --git a/src/test/run-pass/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures-generic.rs index 04c124946c9a1..f4af42a866b6d 100644 --- a/src/test/run-pass/unboxed-closures-generic.rs +++ b/src/test/run-pass/unboxed-closures-generic.rs @@ -17,7 +17,7 @@ fn call_iti32>(y: i32, mut f: F) -> i32 { } pub fn main() { - let f = |&mut: x: i32, y: i32| -> i32 { x + y }; + let f = |x: i32, y: i32| -> i32 { x + y }; let z = call_it(3, f); println!("{}", z); assert_eq!(z, 5); diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs index 5bebc70ca5422..56de15961101f 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs index a678c7a852ff5..c74ed665e7a07 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs @@ -18,5 +18,5 @@ use std::num::ToPrimitive; fn doit(val: T, f: &Fn(T)) { f.call((val,)) } pub fn main() { - doit(0, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs index 6e0b3625a2ee5..a61dd095a0d4d 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures-monomorphization.rs index 29064f4805339..535c4562362c0 100644 --- a/src/test/run-pass/unboxed-closures-monomorphization.rs +++ b/src/test/run-pass/unboxed-closures-monomorphization.rs @@ -17,7 +17,7 @@ fn main(){ fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { - box move |&mut:| t.clone() + box move || t.clone() } let mut f = bar(42_u32); diff --git a/src/test/run-pass/unboxed-closures-move-mutable.rs b/src/test/run-pass/unboxed-closures-move-mutable.rs index 43a44eca2d05e..0d04aee2a1519 100644 --- a/src/test/run-pass/unboxed-closures-move-mutable.rs +++ b/src/test/run-pass/unboxed-closures-move-mutable.rs @@ -21,18 +21,18 @@ fn set(x: &mut uint) { *x = 42; } fn main() { { let mut x = 0u; - move |&mut:| x += 1; + move || x += 1; } { let mut x = 0u; - move |:| x += 1; + move || x += 1; } { let mut x = 0u; - move |&mut:| set(&mut x); + move || set(&mut x); } { let mut x = 0u; - move |:| set(&mut x); + move || set(&mut x); } } diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index f9fc5770a3814..c8f0d5fde45ef 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -15,13 +15,13 @@ #![feature(unboxed_closures)] fn main() { - let task: Box int> = box |&: x| x; + let task: Box int> = box |x| x; task.call((0, )); - let mut task: Box int> = box |&mut: x| x; + let mut task: Box int> = box |x| x; task(0); - call(|:x| x, 22); + call(|x| x, 22); } fn call int>(f: F, x: int) -> int { diff --git a/src/test/run-pass/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures-simple.rs index c473db4586ff7..9f29e75be7cca 100644 --- a/src/test/run-pass/unboxed-closures-simple.rs +++ b/src/test/run-pass/unboxed-closures-simple.rs @@ -13,7 +13,7 @@ use std::ops::FnMut; pub fn main() { - let mut f = |&mut: x: int, y: int| -> int { x + y }; + let mut f = |x: int, y: int| -> int { x + y }; let z = f(1, 2); assert_eq!(z, 3); } diff --git a/src/test/run-pass/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures-single-word-env.rs index 61ceb5e140e32..9e543f925f82e 100644 --- a/src/test/run-pass/unboxed-closures-single-word-env.rs +++ b/src/test/run-pass/unboxed-closures-single-word-env.rs @@ -27,8 +27,8 @@ fn c int>(f: F) -> int { fn main() { let z = 10; - assert_eq!(a(move |&: x: int, y| x + y + z), 13); - assert_eq!(b(move |&mut: x: int, y| x + y + z), 17); - assert_eq!(c(move |: x: int, y| x + y + z), 21); + assert_eq!(a(move |x: int, y| x + y + z), 13); + assert_eq!(b(move |x: int, y| x + y + z), 17); + assert_eq!(c(move |x: int, y| x + y + z), 21); } diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs index e4b35aada9f6b..7a6b68a5e09ec 100644 --- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs @@ -11,7 +11,7 @@ #![feature(unboxed_closures)] fn main() { - let onetime = |: x| x; + let onetime = |x| x; onetime(0); } diff --git a/src/test/run-pass/unboxed-closures-unique-type-id.rs b/src/test/run-pass/unboxed-closures-unique-type-id.rs index a04301931da6a..2871b5c686203 100644 --- a/src/test/run-pass/unboxed-closures-unique-type-id.rs +++ b/src/test/run-pass/unboxed-closures-unique-type-id.rs @@ -30,6 +30,6 @@ pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T { pub fn main() { let mut a = 7u; let b = &mut a; - replace_map(b, |: x: uint| x * 2); + replace_map(b, |x: uint| x * 2); assert_eq!(*b, 14u); } diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index a2d1b8780aaff..4e8fdda956311 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -13,6 +13,6 @@ pub fn main() { let _x = box 1; - let lam_move = |&:| {}; + let lam_move = || {}; lam_move(); } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 4080796b7a741..c9f070a279c76 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -26,7 +26,7 @@ fn what() { return while !x.get() { x.set(true); }; } let i = &Cell::new(false); - let dont = {|&:|the(i)}; + let dont = {||the(i)}; dont(); assert!((i.get())); } diff --git a/src/test/run-pass/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses-unboxed-closures.rs index 808e937bc72e3..7edcdf6429223 100644 --- a/src/test/run-pass/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses-unboxed-closures.rs @@ -18,9 +18,9 @@ fn warm_up<'a, F>(f: F) where F: Fn(&'a mut Bencher) { fn main() { // ICE trigger - warm_up(|&: b: &mut Bencher| () ); + warm_up(|b: &mut Bencher| () ); // OK - warm_up(|&: b| () ); + warm_up(|b| () ); }