forked from Rust-related/RustPython
Implement new clippy lints (#5208)
* Implement new clippy lints clippy was just updated and has a few minor issues with the code base. * Forgotten lint hidden behind feature
This commit is contained in:
@@ -46,7 +46,7 @@ mod non_threading {
|
||||
F: FnOnce() -> Result<T, E>,
|
||||
{
|
||||
self.inner
|
||||
.with(|x| x.get_or_try_init(|| f().map(leak)).map(|&x| x))
|
||||
.with(|x| x.get_or_try_init(|| f().map(leak)).copied())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ pub mod levenshtein {
|
||||
|
||||
pub fn levenshtein_distance(a: &str, b: &str, max_cost: usize) -> usize {
|
||||
thread_local! {
|
||||
static BUFFER: RefCell<[usize; MAX_STRING_SIZE]> = RefCell::new([0usize; MAX_STRING_SIZE]);
|
||||
static BUFFER: RefCell<[usize; MAX_STRING_SIZE]> = const { RefCell::new([0usize; MAX_STRING_SIZE]) };
|
||||
}
|
||||
|
||||
if a == b {
|
||||
|
||||
@@ -1047,7 +1047,7 @@ impl Hashable for PyMemoryView {
|
||||
}
|
||||
Ok(zelf.contiguous_or_collect(|bytes| vm.state.hash_secret.hash_bytes(bytes)))
|
||||
})
|
||||
.map(|&x| x)
|
||||
.copied()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ pub(super) mod _os {
|
||||
if self.is_symlink(vm)? {
|
||||
do_stat(true)
|
||||
} else {
|
||||
lstat().map(Clone::clone)
|
||||
lstat().cloned()
|
||||
}
|
||||
})?
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user