Merge pull request #1615 from birkenfeld/new_clippy

This commit is contained in:
Georg Brandl 2021-05-17 14:58:34 +02:00 committed by GitHub
commit ea0fdb4928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View File

@ -69,7 +69,7 @@ mod test {
let py = gil.python();
assert!(PyBool::new(py, true).is_true());
let t: &PyAny = PyBool::new(py, true).into();
assert_eq!(true, t.extract().unwrap());
assert!(t.extract::<bool>().unwrap());
assert_eq!(true.to_object(py), PyBool::new(py, true).into());
}
@ -79,7 +79,7 @@ mod test {
let py = gil.python();
assert!(!PyBool::new(py, false).is_true());
let t: &PyAny = PyBool::new(py, false).into();
assert_eq!(false, t.extract().unwrap());
assert!(!t.extract::<bool>().unwrap());
assert_eq!(false.to_object(py), PyBool::new(py, false).into());
}
}

View File

@ -422,8 +422,8 @@ mod tests {
let a = PyDateTime::new_with_fold(py, 2021, 1, 23, 20, 32, 40, 341516, None, false);
let b = PyDateTime::new_with_fold(py, 2021, 1, 23, 20, 32, 40, 341516, None, true);
assert_eq!(a.unwrap().get_fold(), false);
assert_eq!(b.unwrap().get_fold(), true);
assert!(!a.unwrap().get_fold());
assert!(b.unwrap().get_fold());
});
}
}

View File

@ -528,8 +528,8 @@ mod test {
v.insert(7, 32);
let ob = v.to_object(py);
let dict = <PyDict as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
assert_eq!(true, dict.contains(7i32).unwrap());
assert_eq!(false, dict.contains(8i32).unwrap());
assert!(dict.contains(7i32).unwrap());
assert!(!dict.contains(8i32).unwrap());
}
#[test]

View File

@ -370,7 +370,7 @@ mod test {
assert_eq!(0, seq.len().unwrap());
let needle = 7i32.to_object(py);
assert_eq!(false, seq.contains(&needle).unwrap());
assert!(!seq.contains(&needle).unwrap());
}
#[test]
@ -383,13 +383,13 @@ mod test {
assert_eq!(6, seq.len().unwrap());
let bad_needle = 7i32.to_object(py);
assert_eq!(false, seq.contains(&bad_needle).unwrap());
assert!(!seq.contains(&bad_needle).unwrap());
let good_needle = 8i32.to_object(py);
assert_eq!(true, seq.contains(&good_needle).unwrap());
assert!(seq.contains(&good_needle).unwrap());
let type_coerced_needle = 8f32.to_object(py);
assert_eq!(true, seq.contains(&type_coerced_needle).unwrap());
assert!(seq.contains(&type_coerced_needle).unwrap());
}
#[test]
@ -527,10 +527,10 @@ mod test {
let seq = ob.cast_as::<PySequence>(py).unwrap();
let bad_needle = "blurst".to_object(py);
assert_eq!(false, seq.contains(bad_needle).unwrap());
assert!(!seq.contains(bad_needle).unwrap());
let good_needle = "worst".to_object(py);
assert_eq!(true, seq.contains(good_needle).unwrap());
assert!(seq.contains(good_needle).unwrap());
}
#[test]
@ -668,10 +668,10 @@ mod test {
let py = gil.python();
let list = vec![1].to_object(py);
let seq = list.cast_as::<PySequence>(py).unwrap();
assert_eq!(seq.is_empty().unwrap(), false);
assert!(!seq.is_empty().unwrap());
let vec: Vec<u32> = Vec::new();
let empty_list = vec.to_object(py);
let empty_seq = empty_list.cast_as::<PySequence>(py).unwrap();
assert_eq!(empty_seq.is_empty().unwrap(), true);
assert!(empty_seq.is_empty().unwrap());
}
}

View File

@ -240,7 +240,7 @@ fn test_unsendable<T: PyClass + 'static>() -> PyResult<()> {
}))
.is_err();
assert_eq!(caught_panic, false);
assert!(!caught_panic);
Ok(obj)
})
})