diff options
author | linbingquan <695601626@qq.com> | 2022-12-18 06:20:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 23:20:15 +0100 |
commit | f46df3e35940fc78163945eed33e58fafed0b06b (patch) | |
tree | c22233bf2019a254045ad0af533225d3f02a402f /ext | |
parent | f2c9cc500c84a3c6051823cd3ae33d6b4c1f6266 (diff) |
chore: update to Rust 1.66.0 (#17078)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/cache/sqlite.rs | 2 | ||||
-rw-r--r-- | ext/ffi/callback.rs | 7 | ||||
-rw-r--r-- | ext/ffi/ir.rs | 8 | ||||
-rw-r--r-- | ext/ffi/repr.rs | 8 | ||||
-rw-r--r-- | ext/ffi/turbocall.rs | 2 | ||||
-rw-r--r-- | ext/node/resolution.rs | 2 | ||||
-rw-r--r-- | ext/web/timers.rs | 2 |
7 files changed, 14 insertions, 17 deletions
diff --git a/ext/cache/sqlite.rs b/ext/cache/sqlite.rs index caf386777..f1314516f 100644 --- a/ext/cache/sqlite.rs +++ b/ext/cache/sqlite.rs @@ -114,7 +114,7 @@ impl Cache for SqliteBackedCache { }, )?; let responses_dir = get_responses_dir(cache_storage_dir, cache_id); - std::fs::create_dir_all(&responses_dir)?; + std::fs::create_dir_all(responses_dir)?; Ok::<i64, AnyError>(cache_id) }) .await? diff --git a/ext/ffi/callback.rs b/ext/ffi/callback.rs index 9b759a30e..b63bb8eab 100644 --- a/ext/ffi/callback.rs +++ b/ext/ffi/callback.rs @@ -171,7 +171,7 @@ unsafe fn do_ffi_callback( let func = callback.open(scope); let result = result as *mut c_void; let vals: &[*const c_void] = - std::slice::from_raw_parts(args, info.parameters.len() as usize); + std::slice::from_raw_parts(args, info.parameters.len()); let mut params: Vec<v8::Local<v8::Value>> = vec![]; for (native_type, val) in info.parameters.iter().zip(vals) { @@ -307,7 +307,7 @@ unsafe fn do_ffi_callback( // Fallthrough, probably UB. value .int32_value(scope) - .expect("Unable to deserialize result parameter.") as i32 + .expect("Unable to deserialize result parameter.") }; *(result as *mut i32) = value; } @@ -425,8 +425,7 @@ unsafe fn do_ffi_callback( } else { *(result as *mut i64) = value .integer_value(scope) - .expect("Unable to deserialize result parameter.") - as i64; + .expect("Unable to deserialize result parameter."); } } NativeType::U64 => { diff --git a/ext/ffi/ir.rs b/ext/ffi/ir.rs index 67c65b5b5..ee67171a4 100644 --- a/ext/ffi/ir.rs +++ b/ext/ffi/ir.rs @@ -250,7 +250,7 @@ pub fn ffi_parse_u32_arg( ) -> Result<NativeValue, AnyError> { let u32_value = v8::Local::<v8::Uint32>::try_from(arg) .map_err(|_| type_error("Invalid FFI u32 type, expected unsigned integer"))? - .value() as u32; + .value(); Ok(NativeValue { u32_value }) } @@ -260,7 +260,7 @@ pub fn ffi_parse_i32_arg( ) -> Result<NativeValue, AnyError> { let i32_value = v8::Local::<v8::Int32>::try_from(arg) .map_err(|_| type_error("Invalid FFI i32 type, expected integer"))? - .value() as i32; + .value(); Ok(NativeValue { i32_value }) } @@ -297,7 +297,7 @@ pub fn ffi_parse_i64_arg( { value.i64_value().0 } else if let Ok(value) = v8::Local::<v8::Number>::try_from(arg) { - value.integer_value(scope).unwrap() as i64 + value.integer_value(scope).unwrap() } else { return Err(type_error("Invalid FFI i64 type, expected integer")); }; @@ -358,7 +358,7 @@ pub fn ffi_parse_f64_arg( ) -> Result<NativeValue, AnyError> { let f64_value = v8::Local::<v8::Number>::try_from(arg) .map_err(|_| type_error("Invalid FFI f64 type, expected number"))? - .value() as f64; + .value(); Ok(NativeValue { f64_value }) } diff --git a/ext/ffi/repr.rs b/ext/ffi/repr.rs index 22cf03a6b..20b98154c 100644 --- a/ext/ffi/repr.rs +++ b/ext/ffi/repr.rs @@ -301,9 +301,7 @@ where } // SAFETY: ptr and offset are user provided. - Ok(unsafe { - ptr::read_unaligned::<u32>(ptr.add(offset) as *const u32) as u32 - }) + Ok(unsafe { ptr::read_unaligned::<u32>(ptr.add(offset) as *const u32) }) } #[op(fast)] @@ -327,9 +325,7 @@ where } // SAFETY: ptr and offset are user provided. - Ok(unsafe { - ptr::read_unaligned::<i32>(ptr.add(offset) as *const i32) as i32 - }) + Ok(unsafe { ptr::read_unaligned::<i32>(ptr.add(offset) as *const i32) }) } #[op] diff --git a/ext/ffi/turbocall.rs b/ext/ffi/turbocall.rs index 79ec814b4..bbe29238a 100644 --- a/ext/ffi/turbocall.rs +++ b/ext/ffi/turbocall.rs @@ -910,6 +910,7 @@ impl Aarch64Apple { aarch64!(self.assmblr; str x0, [x19]); } + #[allow(clippy::unnecessary_cast)] fn save_frame_record(&mut self) { debug_assert!( self.allocated_stack >= 16, @@ -922,6 +923,7 @@ impl Aarch64Apple { ) } + #[allow(clippy::unnecessary_cast)] fn recover_frame_record(&mut self) { // The stack cannot have been deallocated before the frame record is restored debug_assert!( diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs index 10f085070..cd9496ad4 100644 --- a/ext/node/resolution.rs +++ b/ext/node/resolution.rs @@ -888,7 +888,7 @@ pub fn legacy_main_resolve( .path .parent() .unwrap() - .join(&format!("{}{}", main, ending)) + .join(format!("{}{}", main, ending)) .clean(); if file_exists(&guess) { // TODO(bartlomieju): emitLegacyIndexDeprecation() diff --git a/ext/web/timers.rs b/ext/web/timers.rs index 5b1310792..6026b7c3b 100644 --- a/ext/web/timers.rs +++ b/ext/web/timers.rs @@ -51,7 +51,7 @@ where // SAFETY: buffer is at least 8 bytes long. unsafe { std::slice::from_raw_parts_mut(buf.as_mut_ptr() as _, 2) }; buf[0] = seconds as u32; - buf[1] = subsec_nanos as u32; + buf[1] = subsec_nanos; } pub struct TimerHandle(Rc<CancelHandle>); |