Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichton
r? @alexcrichton
This commit is contained in:
commit
288809c8f3
104 changed files with 262 additions and 259 deletions
|
|
@ -43,7 +43,7 @@ fn maybe_run_test<F>(argv: &[String], name: String, test: F) where F: FnOnce() {
|
|||
|
||||
if env::var_os("RUST_BENCH").is_some() {
|
||||
run_test = true
|
||||
} else if argv.len() > 0 {
|
||||
} else if !argv.is_empty() {
|
||||
run_test = argv.iter().any(|x| x == &"all".to_string()) || argv.iter().any(|x| x == &name)
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ fn shift_push() {
|
|||
let mut v1 = repeat(1).take(30000).collect::<Vec<_>>();
|
||||
let mut v2 = Vec::new();
|
||||
|
||||
while v1.len() > 0 {
|
||||
while !v1.is_empty() {
|
||||
v2.push(v1.remove(0));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ fn main() {
|
|||
for line in rdr.lines() {
|
||||
let line = line.unwrap().trim().to_string();
|
||||
|
||||
if line.len() == 0 { continue; }
|
||||
if line.is_empty() { continue; }
|
||||
|
||||
match (line.as_bytes()[0] as char, proc_mode) {
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ fn generate_frequencies(mut input: &[u8], frame: usize) -> Table {
|
|||
}
|
||||
frequencies.lookup(code, BumpCallback);
|
||||
|
||||
while input.len() != 0 && input[0] != ('>' as u8) {
|
||||
while !input.is_empty() && input[0] != ('>' as u8) {
|
||||
code = code.rotate(input[0], frame);
|
||||
frequencies.lookup(code, BumpCallback);
|
||||
input = &input[1..];
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
|
|||
use std::mem;
|
||||
use std::raw::Repr;
|
||||
|
||||
if r.len() == 0 { return None }
|
||||
if r.is_empty() { return None }
|
||||
unsafe {
|
||||
let mut raw = r.repr();
|
||||
let ret = raw.data as *mut T;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ pub fn main() {
|
|||
|
||||
// Zero size vec.
|
||||
let f5: &Fat<[isize]> = &Fat { ptr: [] };
|
||||
assert!(f5.ptr.len() == 0);
|
||||
assert!(f5.ptr.is_empty());
|
||||
let f5: &Fat<[Bar]> = &Fat { ptr: [] };
|
||||
assert!(f5.ptr.len() == 0);
|
||||
assert!(f5.ptr.is_empty());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ pub fn main() {
|
|||
|
||||
// Zero size vec.
|
||||
let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] };
|
||||
assert!(f5.ptr.len() == 0);
|
||||
assert!(f5.ptr.is_empty());
|
||||
let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] };
|
||||
assert!(f5.ptr.len() == 0);
|
||||
assert!(f5.ptr.is_empty());
|
||||
|
||||
// Deeply nested.
|
||||
let f1 = Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} };
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ fn main() {
|
|||
let middle = XYZ{x: 0, y: 0, z: 0};
|
||||
border.insert(middle);
|
||||
|
||||
while border.len() > 0 && connected.len() < 10000 {
|
||||
while !border.is_empty() && connected.len() < 10000 {
|
||||
let choice = *(border.iter().next().unwrap());
|
||||
border.remove(&choice);
|
||||
connected.insert(choice);
|
||||
|
|
|
|||
|
|
@ -44,5 +44,5 @@ pub fn main()
|
|||
"foo".to_string(), "foo".to_string(), "foo".to_string(),
|
||||
"foo".to_string());
|
||||
let v = format!("{:?}", u); // this is the line that causes the seg fault
|
||||
assert!(v.len() > 0);
|
||||
assert!(!v.is_empty());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue