Skip to content

Commit 19354d9

Browse files
committed
suffix removal
1 parent fe5ca21 commit 19354d9

File tree

333 files changed

+1120
-1132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+1120
-1132
lines changed

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//! }
4343
//! ```
4444
//!
45-
//! This will print `Cons(1i32, Box(Cons(2i32, Box(Nil))))`.
45+
//! This will print `Cons(1, Box(Cons(2, Box(Nil))))`.
4646
4747
#![stable(feature = "rust1", since = "1.0.0")]
4848

src/liballoc/boxed_test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ fn test_show() {
7272
#[test]
7373
fn deref() {
7474
fn homura<T: Deref<Target=i32>>(_: T) { }
75-
homura(Box::new(765i32));
75+
homura(Box::new(765));
7676
}
7777

7878
#[test]
7979
fn raw_sized() {
8080
unsafe {
81-
let x = Box::new(17i32);
81+
let x = Box::new(17);
8282
let p = boxed::into_raw(x);
8383
assert_eq!(17, *p);
8484
*p = 19;

src/libcollections/bit.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ fn match_words <'a,'b>(a: &'a BitVec, b: &'b BitVec) -> (MatchWords<'a>, MatchWo
118118

119119
// have to uselessly pretend to pad the longer one for type matching
120120
if a_len < b_len {
121-
(a.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(b_len).skip(a_len)),
122-
b.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(0).skip(0)))
121+
(a.blocks().enumerate().chain(iter::repeat(0).enumerate().take(b_len).skip(a_len)),
122+
b.blocks().enumerate().chain(iter::repeat(0).enumerate().take(0).skip(0)))
123123
} else {
124-
(a.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(0).skip(0)),
125-
b.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(a_len).skip(b_len)))
124+
(a.blocks().enumerate().chain(iter::repeat(0).enumerate().take(0).skip(0)),
125+
b.blocks().enumerate().chain(iter::repeat(0).enumerate().take(a_len).skip(b_len)))
126126
}
127127
}
128128

@@ -199,7 +199,7 @@ fn blocks_for_bits(bits: usize) -> usize {
199199
/// Computes the bitmask for the final word of the vector
200200
fn mask_for_bits(bits: usize) -> u32 {
201201
// Note especially that a perfect multiple of u32::BITS should mask all 1s.
202-
!0u32 >> (u32::BITS - bits % u32::BITS) % u32::BITS
202+
!0 >> (u32::BITS - bits % u32::BITS) % u32::BITS
203203
}
204204

205205
impl BitVec {
@@ -275,7 +275,7 @@ impl BitVec {
275275
pub fn from_elem(nbits: usize, bit: bool) -> BitVec {
276276
let nblocks = blocks_for_bits(nbits);
277277
let mut bit_vec = BitVec {
278-
storage: repeat(if bit { !0u32 } else { 0u32 }).take(nblocks).collect(),
278+
storage: repeat(if bit { !0 } else { 0 }).take(nblocks).collect(),
279279
nbits: nbits
280280
};
281281
bit_vec.fix_last_block();
@@ -330,7 +330,7 @@ impl BitVec {
330330
}
331331

332332
if extra_bytes > 0 {
333-
let mut last_word = 0u32;
333+
let mut last_word = 0;
334334
for (i, &byte) in bytes[complete_words*4..].iter().enumerate() {
335335
last_word |= (reverse_bits(byte) as u32) << (i * 8);
336336
}
@@ -431,7 +431,7 @@ impl BitVec {
431431
/// ```
432432
#[inline]
433433
pub fn set_all(&mut self) {
434-
for w in &mut self.storage { *w = !0u32; }
434+
for w in &mut self.storage { *w = !0; }
435435
self.fix_last_block();
436436
}
437437

@@ -566,12 +566,12 @@ impl BitVec {
566566
/// assert_eq!(bv.all(), false);
567567
/// ```
568568
pub fn all(&self) -> bool {
569-
let mut last_word = !0u32;
569+
let mut last_word = !0;
570570
// Check that every block but the last is all-ones...
571571
self.blocks().all(|elem| {
572572
let tmp = last_word;
573573
last_word = elem;
574-
tmp == !0u32
574+
tmp == !0
575575
// and then check the last one has enough ones
576576
}) && (last_word == mask_for_bits(self.nbits))
577577
}
@@ -912,7 +912,7 @@ impl BitVec {
912912
#[inline]
913913
#[stable(feature = "rust1", since = "1.0.0")]
914914
pub fn clear(&mut self) {
915-
for w in &mut self.storage { *w = 0u32; }
915+
for w in &mut self.storage { *w = 0; }
916916
}
917917
}
918918

@@ -2313,7 +2313,7 @@ mod tests {
23132313

23142314
assert_eq!(bit_vec.iter().collect::<Vec<bool>>(), bools);
23152315

2316-
let long: Vec<_> = (0i32..10000).map(|i| i % 2 == 0).collect();
2316+
let long: Vec<_> = (0..10000).map(|i| i % 2 == 0).collect();
23172317
let bit_vec: BitVec = long.iter().map(|n| *n).collect();
23182318
assert_eq!(bit_vec.iter().collect::<Vec<bool>>(), long)
23192319
}

src/libcollections/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
//! Some examples of the output from both traits:
227227
//!
228228
//! ```
229-
//! assert_eq!(format!("{} {:?}", 3i32, 4i32), "3 4");
229+
//! assert_eq!(format!("{} {:?}", 3, 4), "3 4");
230230
//! assert_eq!(format!("{} {:?}", 'a', 'b'), "a 'b'");
231231
//! assert_eq!(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\"");
232232
//! ```

src/libcollections/slice.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ mod tests {
26322632
#[test]
26332633
fn test_bytes_set_memory() {
26342634
use slice::bytes::MutableByteVector;
2635-
let mut values = [1u8,2,3,4,5];
2635+
let mut values = [1,2,3,4,5];
26362636
values[0..5].set_memory(0xAB);
26372637
assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
26382638
values[2..4].set_memory(0xFF);
@@ -2802,26 +2802,26 @@ mod tests {
28022802
fn test_mut_chunks() {
28032803
use core::iter::ExactSizeIterator;
28042804

2805-
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
2805+
let mut v = [0, 1, 2, 3, 4, 5, 6];
28062806
assert_eq!(v.chunks_mut(2).len(), 4);
28072807
for (i, chunk) in v.chunks_mut(3).enumerate() {
28082808
for x in chunk {
28092809
*x = i as u8;
28102810
}
28112811
}
2812-
let result = [0u8, 0, 0, 1, 1, 1, 2];
2812+
let result = [0, 0, 0, 1, 1, 1, 2];
28132813
assert!(v == result);
28142814
}
28152815

28162816
#[test]
28172817
fn test_mut_chunks_rev() {
2818-
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
2818+
let mut v = [0, 1, 2, 3, 4, 5, 6];
28192819
for (i, chunk) in v.chunks_mut(3).rev().enumerate() {
28202820
for x in chunk {
28212821
*x = i as u8;
28222822
}
28232823
}
2824-
let result = [2u8, 2, 2, 1, 1, 1, 0];
2824+
let result = [2, 2, 2, 1, 1, 1, 0];
28252825
assert!(v == result);
28262826
}
28272827

src/libcollections/str.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ macro_rules! utf8_first_byte {
383383

384384
// return the value of $ch updated with continuation byte $byte
385385
macro_rules! utf8_acc_cont_byte {
386-
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63u8) as u32)
386+
($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
387387
}
388388

389389
#[stable(feature = "rust1", since = "1.0.0")]
@@ -2299,8 +2299,8 @@ mod tests {
22992299

23002300
#[test]
23012301
fn test_chars_decoding() {
2302-
let mut bytes = [0u8; 4];
2303-
for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
2302+
let mut bytes = [0; 4];
2303+
for c in (0..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
23042304
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
23052305
let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
23062306
if Some(c) != s.chars().next() {
@@ -2311,8 +2311,8 @@ mod tests {
23112311

23122312
#[test]
23132313
fn test_chars_rev_decoding() {
2314-
let mut bytes = [0u8; 4];
2315-
for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
2314+
let mut bytes = [0; 4];
2315+
for c in (0..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
23162316
let len = c.encode_utf8(&mut bytes).unwrap_or(0);
23172317
let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
23182318
if Some(c) != s.chars().rev().next() {

src/libcollections/string.rs

+36-36
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl String {
153153
}
154154
}
155155

156-
static TAG_CONT_U8: u8 = 128u8;
156+
static TAG_CONT_U8: u8 = 128;
157157
static REPLACEMENT: &'static [u8] = b"\xEF\xBF\xBD"; // U+FFFD in UTF-8
158158
let total = v.len();
159159
fn unsafe_get(xs: &[u8], i: usize) -> u8 {
@@ -195,14 +195,14 @@ impl String {
195195
}
196196
})}
197197

198-
if byte < 128u8 {
198+
if byte < 128 {
199199
// subseqidx handles this
200200
} else {
201201
let w = unicode_str::utf8_char_width(byte);
202202

203203
match w {
204204
2 => {
205-
if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
205+
if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
206206
error!();
207207
continue;
208208
}
@@ -220,7 +220,7 @@ impl String {
220220
}
221221
}
222222
i += 1;
223-
if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
223+
if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
224224
error!();
225225
continue;
226226
}
@@ -237,12 +237,12 @@ impl String {
237237
}
238238
}
239239
i += 1;
240-
if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
240+
if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
241241
error!();
242242
continue;
243243
}
244244
i += 1;
245-
if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
245+
if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
246246
error!();
247247
continue;
248248
}
@@ -1084,40 +1084,40 @@ mod tests {
10841084
fn test_from_utf16() {
10851085
let pairs =
10861086
[(String::from_str("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
1087-
vec![0xd800_u16, 0xdf45_u16, 0xd800_u16, 0xdf3f_u16,
1088-
0xd800_u16, 0xdf3b_u16, 0xd800_u16, 0xdf46_u16,
1089-
0xd800_u16, 0xdf39_u16, 0xd800_u16, 0xdf3b_u16,
1090-
0xd800_u16, 0xdf30_u16, 0x000a_u16]),
1087+
vec![0xd800, 0xdf45, 0xd800, 0xdf3f,
1088+
0xd800, 0xdf3b, 0xd800, 0xdf46,
1089+
0xd800, 0xdf39, 0xd800, 0xdf3b,
1090+
0xd800, 0xdf30, 0x000a]),
10911091

10921092
(String::from_str("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
1093-
vec![0xd801_u16, 0xdc12_u16, 0xd801_u16,
1094-
0xdc49_u16, 0xd801_u16, 0xdc2e_u16, 0xd801_u16,
1095-
0xdc40_u16, 0xd801_u16, 0xdc32_u16, 0xd801_u16,
1096-
0xdc4b_u16, 0x0020_u16, 0xd801_u16, 0xdc0f_u16,
1097-
0xd801_u16, 0xdc32_u16, 0xd801_u16, 0xdc4d_u16,
1098-
0x000a_u16]),
1093+
vec![0xd801, 0xdc12, 0xd801,
1094+
0xdc49, 0xd801, 0xdc2e, 0xd801,
1095+
0xdc40, 0xd801, 0xdc32, 0xd801,
1096+
0xdc4b, 0x0020, 0xd801, 0xdc0f,
1097+
0xd801, 0xdc32, 0xd801, 0xdc4d,
1098+
0x000a]),
10991099

11001100
(String::from_str("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
1101-
vec![0xd800_u16, 0xdf00_u16, 0xd800_u16, 0xdf16_u16,
1102-
0xd800_u16, 0xdf0b_u16, 0xd800_u16, 0xdf04_u16,
1103-
0xd800_u16, 0xdf11_u16, 0xd800_u16, 0xdf09_u16,
1104-
0x00b7_u16, 0xd800_u16, 0xdf0c_u16, 0xd800_u16,
1105-
0xdf04_u16, 0xd800_u16, 0xdf15_u16, 0xd800_u16,
1106-
0xdf04_u16, 0xd800_u16, 0xdf0b_u16, 0xd800_u16,
1107-
0xdf09_u16, 0xd800_u16, 0xdf11_u16, 0x000a_u16 ]),
1101+
vec![0xd800, 0xdf00, 0xd800, 0xdf16,
1102+
0xd800, 0xdf0b, 0xd800, 0xdf04,
1103+
0xd800, 0xdf11, 0xd800, 0xdf09,
1104+
0x00b7, 0xd800, 0xdf0c, 0xd800,
1105+
0xdf04, 0xd800, 0xdf15, 0xd800,
1106+
0xdf04, 0xd800, 0xdf0b, 0xd800,
1107+
0xdf09, 0xd800, 0xdf11, 0x000a ]),
11081108

11091109
(String::from_str("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
1110-
vec![0xd801_u16, 0xdc8b_u16, 0xd801_u16, 0xdc98_u16,
1111-
0xd801_u16, 0xdc88_u16, 0xd801_u16, 0xdc91_u16,
1112-
0xd801_u16, 0xdc9b_u16, 0xd801_u16, 0xdc92_u16,
1113-
0x0020_u16, 0xd801_u16, 0xdc95_u16, 0xd801_u16,
1114-
0xdc93_u16, 0x0020_u16, 0xd801_u16, 0xdc88_u16,
1115-
0xd801_u16, 0xdc9a_u16, 0xd801_u16, 0xdc8d_u16,
1116-
0x0020_u16, 0xd801_u16, 0xdc8f_u16, 0xd801_u16,
1117-
0xdc9c_u16, 0xd801_u16, 0xdc92_u16, 0xd801_u16,
1118-
0xdc96_u16, 0xd801_u16, 0xdc86_u16, 0x0020_u16,
1119-
0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
1120-
0x000a_u16 ]),
1110+
vec![0xd801, 0xdc8b, 0xd801, 0xdc98,
1111+
0xd801, 0xdc88, 0xd801, 0xdc91,
1112+
0xd801, 0xdc9b, 0xd801, 0xdc92,
1113+
0x0020, 0xd801, 0xdc95, 0xd801,
1114+
0xdc93, 0x0020, 0xd801, 0xdc88,
1115+
0xd801, 0xdc9a, 0xd801, 0xdc8d,
1116+
0x0020, 0xd801, 0xdc8f, 0xd801,
1117+
0xdc9c, 0xd801, 0xdc92, 0xd801,
1118+
0xdc96, 0xd801, 0xdc86, 0x0020,
1119+
0xd801, 0xdc95, 0xd801, 0xdc86,
1120+
0x000a ]),
11211121
// Issue #12318, even-numbered non-BMP planes
11221122
(String::from_str("\u{20000}"),
11231123
vec![0xD840, 0xDC00])];
@@ -1303,7 +1303,7 @@ mod tests {
13031303
assert_eq!(1.to_string(), "1");
13041304
assert_eq!((-1).to_string(), "-1");
13051305
assert_eq!(200.to_string(), "200");
1306-
assert_eq!(2u8.to_string(), "2");
1306+
assert_eq!(2.to_string(), "2");
13071307
assert_eq!(true.to_string(), "true");
13081308
assert_eq!(false.to_string(), "false");
13091309
assert_eq!(("hi".to_string()).to_string(), "hi");
@@ -1421,7 +1421,7 @@ mod tests {
14211421

14221422
#[bench]
14231423
fn from_utf8_lossy_100_invalid(b: &mut Bencher) {
1424-
let s = repeat(0xf5u8).take(100).collect::<Vec<_>>();
1424+
let s = repeat(0xf5).take(100).collect::<Vec<_>>();
14251425
b.iter(|| {
14261426
let _ = String::from_utf8_lossy(&s);
14271427
});

0 commit comments

Comments
 (0)