Skip to content

Commit 6357a1a

Browse files
committed
clean up imports and useless allow attributes
1 parent 0fb5327 commit 6357a1a

Some content is hidden

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

55 files changed

+186
-244
lines changed

benches/execution.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use criterion::{
44
};
55
use rustpython_compiler::Mode;
66
use rustpython_parser::parser::parse_program;
7-
use rustpython_vm::Interpreter;
8-
use rustpython_vm::PyResult;
7+
use rustpython_vm::{Interpreter, PyResult};
98
use std::collections::HashMap;
109
use std::path::Path;
1110

benches/microbenchmarks.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
use criterion::measurement::WallTime;
21
use criterion::{
3-
criterion_group, criterion_main, BatchSize, BenchmarkGroup, BenchmarkId, Criterion, Throughput,
2+
criterion_group, criterion_main, measurement::WallTime, BatchSize, BenchmarkGroup, BenchmarkId,
3+
Criterion, Throughput,
44
};
55
use rustpython_compiler::Mode;
66
use rustpython_vm::{
77
common::ascii, InitParameter, Interpreter, PyObjectWrap, PyResult, PySettings,
88
};
9-
use std::path::{Path, PathBuf};
10-
use std::{ffi, fs, io};
9+
use std::{
10+
ffi, fs, io,
11+
path::{Path, PathBuf},
12+
};
1113

1214
pub struct MicroBenchmark {
1315
name: String,

bytecode/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use itertools::Itertools;
1010
use num_bigint::BigInt;
1111
use num_complex::Complex64;
1212
use serde::{Deserialize, Serialize};
13-
use std::collections::BTreeSet;
14-
use std::{fmt, hash};
13+
use std::{collections::BTreeSet, fmt, hash};
1514

1615
/// Sourcecode location.
1716
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]

common/src/boxvec.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
//! An unresizable vector backed by a `Box<[T]>`
22
3-
use std::borrow::{Borrow, BorrowMut};
4-
use std::mem::{self, MaybeUninit};
5-
use std::ops::{Bound, Deref, DerefMut, RangeBounds};
6-
use std::{alloc, cmp, fmt, ptr, slice};
3+
use std::{
4+
alloc,
5+
borrow::{Borrow, BorrowMut},
6+
cmp, fmt,
7+
mem::{self, MaybeUninit},
8+
ops::{Bound, Deref, DerefMut, RangeBounds},
9+
ptr, slice,
10+
};
711

812
pub struct BoxVec<T> {
913
xs: Box<[MaybeUninit<T>]>,
@@ -501,9 +505,7 @@ impl<T> Drop for Drain<'_, T> {
501505
fn drop(&mut self) {
502506
// len is currently 0 so panicking while dropping will not cause a double drop.
503507

504-
// exhaust self first, clippy warning here is seemingly a fluke.
505-
#[allow(clippy::while_let_on_iterator)]
506-
while let Some(_) = self.next() {}
508+
for _ in self.by_ref() {}
507509

508510
if self.tail_len > 0 {
509511
unsafe {

common/src/hash.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ use num_bigint::BigInt;
22
use num_complex::Complex64;
33
use num_traits::ToPrimitive;
44
use siphasher::sip::SipHasher24;
5-
use std::hash::{BuildHasher, Hash, Hasher};
6-
use std::num::Wrapping;
5+
use std::{
6+
hash::{BuildHasher, Hash, Hasher},
7+
num::Wrapping,
8+
};
79

810
pub type PyHash = i64;
911
pub type PyUHash = u64;

common/src/lock/cell_lock.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use lock_api::{
22
GetThreadId, RawMutex, RawRwLock, RawRwLockDowngrade, RawRwLockRecursive, RawRwLockUpgrade,
33
RawRwLockUpgradeDowngrade,
44
};
5-
use std::cell::Cell;
6-
use std::num::NonZeroUsize;
5+
use std::{cell::Cell, num::NonZeroUsize};
76

87
pub struct RawCellMutex {
98
locked: Cell<bool>,

common/src/lock/immutable_mutex.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
use std::fmt;
2-
use std::marker::PhantomData;
3-
use std::ops::Deref;
4-
51
use lock_api::{MutexGuard, RawMutex};
2+
use std::{fmt, marker::PhantomData, ops::Deref};
63

74
/// A mutex guard that has an exclusive lock, but only an immutable reference; useful if you
85
/// need to map a mutex guard with a function that returns an `&T`. Construct using the

common/src/lock/thread_mutex.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use std::cell::UnsafeCell;
2-
use std::fmt;
3-
use std::marker::PhantomData;
4-
use std::ops::{Deref, DerefMut};
5-
use std::ptr::NonNull;
6-
use std::sync::atomic::{AtomicUsize, Ordering};
7-
81
use lock_api::{GetThreadId, GuardNoSend, RawMutex};
2+
use std::{
3+
cell::UnsafeCell,
4+
fmt,
5+
marker::PhantomData,
6+
ops::{Deref, DerefMut},
7+
ptr::NonNull,
8+
sync::atomic::{AtomicUsize, Ordering},
9+
};
910

1011
// based off ReentrantMutex from lock_api
1112

common/src/str.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use ascii::AsciiString;
22
use once_cell::unsync::OnceCell;
3-
use std::fmt;
4-
use std::ops::{Bound, RangeBounds};
3+
use std::{
4+
fmt,
5+
ops::{Bound, RangeBounds},
6+
};
57

68
#[cfg(not(target_arch = "wasm32"))]
79
#[allow(non_camel_case_types)]
@@ -99,8 +101,7 @@ pub const fn bytes_is_ascii(x: &str) -> bool {
99101
}
100102

101103
pub mod levenshtein {
102-
use std::cell::RefCell;
103-
use std::thread_local;
104+
use std::{cell::RefCell, thread_local};
104105

105106
pub const MOVE_COST: usize = 2;
106107
const CASE_COST: usize = 1;

compiler/src/compile.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct CompileContext {
8888
}
8989

9090
#[derive(Debug, Clone, Copy, PartialEq)]
91-
#[allow(clippy::enum_variant_names)]
9291
enum FunctionContext {
9392
NoFunction,
9493
Function,

0 commit comments

Comments
 (0)