Skip to content

Commit 90724b3

Browse files
authored
Implement new clippy lints (RustPython#5208)
* Implement new clippy lints clippy was just updated and has a few minor issues with the code base. * Forgotten lint hidden behind feature
1 parent 85c427b commit 90724b3

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎common/src/static_cell.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mod non_threading {
4646
F: FnOnce() -> Result<T, E>,
4747
{
4848
self.inner
49-
.with(|x| x.get_or_try_init(|| f().map(leak)).map(|&x| x))
49+
.with(|x| x.get_or_try_init(|| f().map(leak)).copied())
5050
}
5151
}
5252

‎common/src/str.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub mod levenshtein {
250250

251251
pub fn levenshtein_distance(a: &str, b: &str, max_cost: usize) -> usize {
252252
thread_local! {
253-
static BUFFER: RefCell<[usize; MAX_STRING_SIZE]> = RefCell::new([0usize; MAX_STRING_SIZE]);
253+
static BUFFER: RefCell<[usize; MAX_STRING_SIZE]> = const { RefCell::new([0usize; MAX_STRING_SIZE]) };
254254
}
255255

256256
if a == b {

‎vm/src/builtins/memory.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ impl Hashable for PyMemoryView {
10471047
}
10481048
Ok(zelf.contiguous_or_collect(|bytes| vm.state.hash_secret.hash_bytes(bytes)))
10491049
})
1050-
.map(|&x| x)
1050+
.copied()
10511051
}
10521052
}
10531053

‎vm/src/stdlib/os.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ pub(super) mod _os {
698698
if self.is_symlink(vm)? {
699699
do_stat(true)
700700
} else {
701-
lstat().map(Clone::clone)
701+
lstat().cloned()
702702
}
703703
})?
704704
} else {

0 commit comments

Comments
 (0)