Skip to content

Commit 1c0e010

Browse files
authored
Merge pull request RustPython#2768 from DimitrisJim/quiet_clippy
clippy: Fix remaining issues
2 parents 46ba32d + 78ffb77 commit 1c0e010

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

common/src/boxvec.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ impl<T> Drop for Drain<'_, T> {
501501
fn drop(&mut self) {
502502
// len is currently 0 so panicking while dropping will not cause a double drop.
503503

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

507508
if self.tail_len > 0 {

vm/src/builtins/function/jitfunc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ fn get_jit_value(vm: &VirtualMachine, obj: &PyObjectRef) -> Result<AbiValue, Arg
111111
// This does exact type checks as subclasses of int/float can't be passed to jitted functions
112112
let cls = obj.class();
113113
if cls.is(&vm.ctx.types.int_type) {
114-
int::get_value(&obj)
114+
int::get_value(obj)
115115
.to_i64()
116116
.map(AbiValue::Int)
117117
.ok_or(ArgsError::IntOverflow)
118118
} else if cls.is(&vm.ctx.types.float_type) {
119-
Ok(AbiValue::Float(float::get_value(&obj)))
119+
Ok(AbiValue::Float(float::get_value(obj)))
120120
} else if cls.is(&vm.ctx.types.bool_type) {
121-
Ok(AbiValue::Bool(pybool::get_value(&obj)))
121+
Ok(AbiValue::Bool(pybool::get_value(obj)))
122122
} else {
123123
Err(ArgsError::NonJitType)
124124
}
@@ -156,13 +156,13 @@ pub(crate) fn get_jit_args<'a>(
156156
if jit_args.is_set(arg_idx) {
157157
return Err(ArgsError::ArgPassedMultipleTimes);
158158
}
159-
jit_args.set(arg_idx, get_jit_value(vm, &value)?)?;
159+
jit_args.set(arg_idx, get_jit_value(vm, value)?)?;
160160
} else if let Some(kwarg_idx) = arg_pos(arg_names.kwonlyargs, name) {
161161
let arg_idx = kwarg_idx + func.code.arg_count;
162162
if jit_args.is_set(arg_idx) {
163163
return Err(ArgsError::ArgPassedMultipleTimes);
164164
}
165-
jit_args.set(arg_idx, get_jit_value(vm, &value)?)?;
165+
jit_args.set(arg_idx, get_jit_value(vm, value)?)?;
166166
} else {
167167
return Err(ArgsError::NotAKeywordArg);
168168
}

vm/src/stdlib/ssl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ fn socket_needs(
700700
ssl::ErrorCode::WANT_WRITE => Some(SslNeeds::Write),
701701
_ => None,
702702
};
703-
let state = needs.map_or(SelectRet::Ok, |needs| ssl_select(sock, needs, &timeout));
703+
let state = needs.map_or(SelectRet::Ok, |needs| ssl_select(sock, needs, timeout));
704704
(needs, state)
705705
}
706706

wasm/lib/src/js_module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl PyJsValue {
218218
.and_then(|proto| proto.value.dyn_ref::<js_sys::Function>());
219219
let js_args = args.iter().map(|x| x.as_ref()).collect::<Array>();
220220
let constructed_result = if let Some(proto) = proto {
221-
Reflect::construct_with_new_target(ctor, &js_args, &proto)
221+
Reflect::construct_with_new_target(ctor, &js_args, proto)
222222
} else {
223223
Reflect::construct(ctor, &js_args)
224224
};

wasm/lib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn panic_hook(info: &panic::PanicInfo) {
2727
None => return,
2828
};
2929
let _ = Reflect::set(&window, &"__RUSTPYTHON_ERROR_MSG".into(), &msg.into());
30-
let error = RuntimeError::new(&msg);
30+
let error = RuntimeError::new(msg);
3131
let _ = Reflect::set(&window, &"__RUSTPYTHON_ERROR".into(), &error);
3232
let stack = match Reflect::get(&error, &"stack".into()) {
3333
Ok(stack) => stack,

0 commit comments

Comments
 (0)