diff --git a/crates/rune-alloc/src/hashbrown/map.rs b/crates/rune-alloc/src/hashbrown/map.rs index b1222b6f5..6b2c5a851 100644 --- a/crates/rune-alloc/src/hashbrown/map.rs +++ b/crates/rune-alloc/src/hashbrown/map.rs @@ -7039,7 +7039,6 @@ mod test_map { use std::collections::hash_map::DefaultHasher; use std::ops::AddAssign; use std::thread; - use std::usize; use std::vec::Vec; use std::{format, println}; diff --git a/crates/rune-alloc/src/hashbrown/raw/mod.rs b/crates/rune-alloc/src/hashbrown/raw/mod.rs index 02c5556df..b0b58b2f8 100644 --- a/crates/rune-alloc/src/hashbrown/raw/mod.rs +++ b/crates/rune-alloc/src/hashbrown/raw/mod.rs @@ -1082,7 +1082,9 @@ impl RawTable { &|cx, table, index| hasher.hash(cx, table.bucket::(index).as_ref()), Self::TABLE_LAYOUT, if T::NEEDS_DROP { - Some(mem::transmute(ptr::drop_in_place:: as unsafe fn(*mut T))) + Some(mem::transmute::( + ptr::drop_in_place:: as unsafe fn(*mut T), + )) } else { None }, @@ -4009,7 +4011,9 @@ mod test_map { &move |cx, table, index| hasher(cx, table.bucket::(index).as_ref()), mem::size_of::(), if mem::needs_drop::() { - Some(mem::transmute(ptr::drop_in_place:: as unsafe fn(*mut T))) + Some(mem::transmute::( + ptr::drop_in_place:: as unsafe fn(*mut T), + )) } else { None }, diff --git a/crates/rune/src/runtime/shared.rs b/crates/rune/src/runtime/shared.rs index 94a45eb77..7624c42cc 100644 --- a/crates/rune/src/runtime/shared.rs +++ b/crates/rune/src/runtime/shared.rs @@ -306,7 +306,10 @@ impl SharedBox { // has already been taken (as indicated by `is_taken`). // // If it has been taken, the shared box contains invalid memory. - drop(transmute::<_, Box>>>(this)); + drop(transmute::< + Box>, + Box>>, + >(this)); } else { // NB: At the point of the final drop, no on else should be using // this. diff --git a/crates/rune/src/workspace/spanned_value.rs b/crates/rune/src/workspace/spanned_value.rs index fc44d40cb..30b2a9642 100644 --- a/crates/rune/src/workspace/spanned_value.rs +++ b/crates/rune/src/workspace/spanned_value.rs @@ -454,11 +454,11 @@ impl<'de> de::Deserialize<'de> for Value { where E: de::Error, { - if value <= i64::max_value() as u64 { - Ok(Value::Integer(value as i64)) - } else { - Err(de::Error::custom("u64 value was too large")) + if let Ok(value) = i64::try_from(value) { + return Ok(Value::Integer(value)); } + + Err(de::Error::custom("u64 value was too large")) } fn visit_u32(self, value: u32) -> Result { diff --git a/examples/examples/checked_add_assign.rs b/examples/examples/checked_add_assign.rs index d5641cbce..86c76bf3f 100644 --- a/examples/examples/checked_add_assign.rs +++ b/examples/examples/checked_add_assign.rs @@ -49,9 +49,7 @@ fn main() -> rune::support::Result<()> { let mut vm = Vm::new(runtime, Arc::new(unit)); - let input = External { - value: i64::max_value(), - }; + let input = External { value: i64::MAX }; let err = vm.call(["main"], (input,)).unwrap_err(); println!("{:?}", err); Ok(()) diff --git a/examples/examples/hot_reloading/path_reloader.rs b/examples/examples/hot_reloading/path_reloader.rs index 3fc7732ae..e6acfe603 100644 --- a/examples/examples/hot_reloading/path_reloader.rs +++ b/examples/examples/hot_reloading/path_reloader.rs @@ -36,6 +36,7 @@ pub enum EventKind { /// A path update event. pub struct Event { /// The path that was modified. + #[allow(unused)] pub path: PathBuf, /// The unit that was constructed from the path. pub unit: Arc,