diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-06-04 21:43:41 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-06-04 21:45:42 -0700 |
| commit | 8114d0e9505b44856b822dd587293fd7895320e4 (patch) | |
| tree | 1e738ee1a533e43733225d9a66b065fb550b6dc7 /src/libextra | |
| parent | 16086ecff7edda82b114a72948762d59095f6fb4 (diff) | |
librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/arena.rs | 2 | ||||
| -rw-r--r-- | src/libextra/fileinput.rs | 24 | ||||
| -rw-r--r-- | src/libextra/md4.rs | 4 | ||||
| -rw-r--r-- | src/libextra/net_url.rs | 2 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 10 | ||||
| -rw-r--r-- | src/libextra/terminfo/parser/compiled.rs | 4 |
6 files changed, 25 insertions, 21 deletions
diff --git a/src/libextra/arena.rs b/src/libextra/arena.rs index 57c2152490f..2926d5958f1 100644 --- a/src/libextra/arena.rs +++ b/src/libextra/arena.rs @@ -134,7 +134,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) { while idx < fill { let tydesc_data: *uint = transmute(ptr::offset(buf, idx)); let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data); - let size = (*tydesc).size, align = (*tydesc).align; + let (size, align) = ((*tydesc).size, (*tydesc).align); let after_tydesc = idx + sys::size_of::<*TypeDesc>(); diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs index 5cc0875cb51..3afa9b51c59 100644 --- a/src/libextra/fileinput.rs +++ b/src/libextra/fileinput.rs @@ -194,8 +194,8 @@ impl FileInput { arguments. `"-"` represents `stdin`. */ pub fn from_args() -> FileInput { - let args = os::args(), - pathed = pathify(args.tail(), true); + let args = os::args(); + let pathed = pathify(args.tail(), true); FileInput::from_vec(pathed) } @@ -222,11 +222,11 @@ impl FileInput { return false; } - let path_option = self.fi.files.shift(), - file = match path_option { - None => io::stdin(), - Some(ref path) => io::file_reader(path).get() - }; + let path_option = self.fi.files.shift(); + let file = match path_option { + None => io::stdin(), + Some(ref path) => io::file_reader(path).get() + }; self.fi.current_reader = Some(file); self.fi.state.current_path = path_option; @@ -431,8 +431,8 @@ mod test { #[test] fn test_pathify() { let strs = [~"some/path", - ~"some/other/path"], - paths = ~[Some(Path("some/path")), + ~"some/other/path"]; + let paths = ~[Some(Path("some/path")), Some(Path("some/other/path"))]; assert_eq!(pathify(strs, true), copy paths); @@ -561,8 +561,10 @@ mod test { #[test] fn test_no_trailing_newline() { - let f1 = Some(Path("tmp/lib-fileinput-test-no-trailing-newline-1.tmp")), - f2 = Some(Path("tmp/lib-fileinput-test-no-trailing-newline-2.tmp")); + let f1 = + Some(Path("tmp/lib-fileinput-test-no-trailing-newline-1.tmp")); + let f2 = + Some(Path("tmp/lib-fileinput-test-no-trailing-newline-2.tmp")); let wr = io::file_writer(f1.get_ref(), [io::Create, io::Truncate]).get(); wr.write_str("1\n2"); diff --git a/src/libextra/md4.rs b/src/libextra/md4.rs index 0f05e50ea70..f12c9d6573e 100644 --- a/src/libextra/md4.rs +++ b/src/libextra/md4.rs @@ -58,9 +58,9 @@ pub fn md4(msg: &[u8]) -> Quad { let e = msg.len(); let mut x = vec::from_elem(16u, 0u32); while i < e { - let aa = a, bb = b, cc = c, dd = d; + let (aa, bb, cc, dd) = (a, b, c, d); - let mut j = 0u, base = i; + let mut (j, base) = (0u, i); while j < 16u { x[j] = (msg[base] as u32) + (msg[base + 1u] as u32 << 8u32) + (msg[base + 2u] as u32 << 16u32) + diff --git a/src/libextra/net_url.rs b/src/libextra/net_url.rs index 58930692965..08540775864 100644 --- a/src/libextra/net_url.rs +++ b/src/libextra/net_url.rs @@ -416,7 +416,7 @@ fn get_authority(rawurl: &str) -> let mut port = None; let mut colon_count = 0; - let mut pos = 0, begin = 2, end = len; + let mut (pos, begin, end) = (0, 2, len); for str::each_chari(rawurl) |i,c| { if i < 2 { loop; } // ignore the leading // diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 82f706e8f3f..77eef1d67ef 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -125,7 +125,7 @@ impl Ord for BigUint { impl TotalOrd for BigUint { fn cmp(&self, other: &BigUint) -> Ordering { - let s_len = self.data.len(), o_len = other.data.len(); + let (s_len, o_len) = (self.data.len(), other.data.len()); if s_len < o_len { return Less; } if s_len > o_len { return Greater; } @@ -255,7 +255,7 @@ impl Mul<BigUint, BigUint> for BigUint { fn mul(&self, other: &BigUint) -> BigUint { if self.is_zero() || other.is_zero() { return Zero::zero(); } - let s_len = self.data.len(), o_len = other.data.len(); + let (s_len, o_len) = (self.data.len(), other.data.len()); if s_len == 1 { return mul_digit(other, self.data[0]); } if o_len == 1 { return mul_digit(self, other.data[0]); } @@ -447,7 +447,7 @@ impl Integer for BigUint { fn gcd(&self, other: &BigUint) -> BigUint { // Use Euclid's algorithm - let mut m = copy *self, n = copy *other; + let mut (m, n) = (copy *self, copy *other); while !m.is_zero() { let temp = m; m = n % temp; @@ -1002,8 +1002,8 @@ impl Integer for BigInt { fn div_mod_floor(&self, other: &BigInt) -> (BigInt, BigInt) { // m.sign == other.sign let (d_ui, m_ui) = self.data.div_rem(&other.data); - let d = BigInt::from_biguint(Plus, d_ui), - m = BigInt::from_biguint(Plus, m_ui); + let d = BigInt::from_biguint(Plus, d_ui); + let m = BigInt::from_biguint(Plus, m_ui); match (self.sign, other.sign) { (_, Zero) => fail!(), (Plus, Plus) | (Zero, Plus) => (d, m), diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 10b6d386085..61c68c27fe5 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -160,7 +160,9 @@ pub static stringnames: &'static[&'static str] = &'static[ "cbt", "_", "cr", "cs /// Parse a compiled terminfo entry, using long capability names if `longnames` is true pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { - let bnames, snames, nnames; + let bnames; + let snames; + let nnames; if longnames { bnames = boolfnames; |
