mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Fix additional needless borrows.
This commit is contained in:
@@ -111,14 +111,14 @@ fn get_jit_value(vm: &VirtualMachine, obj: &PyObjectRef) -> Result<AbiValue, Arg
|
||||
// This does exact type checks as subclasses of int/float can't be passed to jitted functions
|
||||
let cls = obj.class();
|
||||
if cls.is(&vm.ctx.types.int_type) {
|
||||
int::get_value(&obj)
|
||||
int::get_value(obj)
|
||||
.to_i64()
|
||||
.map(AbiValue::Int)
|
||||
.ok_or(ArgsError::IntOverflow)
|
||||
} else if cls.is(&vm.ctx.types.float_type) {
|
||||
Ok(AbiValue::Float(float::get_value(&obj)))
|
||||
Ok(AbiValue::Float(float::get_value(obj)))
|
||||
} else if cls.is(&vm.ctx.types.bool_type) {
|
||||
Ok(AbiValue::Bool(pybool::get_value(&obj)))
|
||||
Ok(AbiValue::Bool(pybool::get_value(obj)))
|
||||
} else {
|
||||
Err(ArgsError::NonJitType)
|
||||
}
|
||||
@@ -156,13 +156,13 @@ pub(crate) fn get_jit_args<'a>(
|
||||
if jit_args.is_set(arg_idx) {
|
||||
return Err(ArgsError::ArgPassedMultipleTimes);
|
||||
}
|
||||
jit_args.set(arg_idx, get_jit_value(vm, &value)?)?;
|
||||
jit_args.set(arg_idx, get_jit_value(vm, value)?)?;
|
||||
} else if let Some(kwarg_idx) = arg_pos(arg_names.kwonlyargs, name) {
|
||||
let arg_idx = kwarg_idx + func.code.arg_count;
|
||||
if jit_args.is_set(arg_idx) {
|
||||
return Err(ArgsError::ArgPassedMultipleTimes);
|
||||
}
|
||||
jit_args.set(arg_idx, get_jit_value(vm, &value)?)?;
|
||||
jit_args.set(arg_idx, get_jit_value(vm, value)?)?;
|
||||
} else {
|
||||
return Err(ArgsError::NotAKeywordArg);
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ fn socket_needs(
|
||||
ssl::ErrorCode::WANT_WRITE => Some(SslNeeds::Write),
|
||||
_ => None,
|
||||
};
|
||||
let state = needs.map_or(SelectRet::Ok, |needs| ssl_select(sock, needs, &timeout));
|
||||
let state = needs.map_or(SelectRet::Ok, |needs| ssl_select(sock, needs, timeout));
|
||||
(needs, state)
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ impl PyJsValue {
|
||||
.and_then(|proto| proto.value.dyn_ref::<js_sys::Function>());
|
||||
let js_args = args.iter().map(|x| x.as_ref()).collect::<Array>();
|
||||
let constructed_result = if let Some(proto) = proto {
|
||||
Reflect::construct_with_new_target(ctor, &js_args, &proto)
|
||||
Reflect::construct_with_new_target(ctor, &js_args, proto)
|
||||
} else {
|
||||
Reflect::construct(ctor, &js_args)
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ pub fn panic_hook(info: &panic::PanicInfo) {
|
||||
None => return,
|
||||
};
|
||||
let _ = Reflect::set(&window, &"__RUSTPYTHON_ERROR_MSG".into(), &msg.into());
|
||||
let error = RuntimeError::new(&msg);
|
||||
let error = RuntimeError::new(msg);
|
||||
let _ = Reflect::set(&window, &"__RUSTPYTHON_ERROR".into(), &error);
|
||||
let stack = match Reflect::get(&error, &"stack".into()) {
|
||||
Ok(stack) => stack,
|
||||
|
||||
Reference in New Issue
Block a user