From dff5f0f5c31ab4de05566b8c80fea15e28e358db Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 4 Nov 2022 09:43:59 +0100 Subject: [PATCH 1/2] Remove derefs that would happen automatically Clippy warns about those in Rust 1.65.0. --- crates/fj/src/abi/context.rs | 2 +- crates/fj/src/abi/ffi_safe.rs | 4 ++-- crates/fj/src/abi/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj/src/abi/context.rs b/crates/fj/src/abi/context.rs index c421382f1..76805a5e2 100644 --- a/crates/fj/src/abi/context.rs +++ b/crates/fj/src/abi/context.rs @@ -19,7 +19,7 @@ impl<'a> From<&'a &dyn crate::models::Context> for Context<'a> { let ctx = &*(user_data as *const &dyn crate::models::Context); match std::panic::catch_unwind(AssertUnwindSafe(|| { - ctx.get_argument(&*name) + ctx.get_argument(&name) })) { Ok(Some(arg)) => StringSlice::from_str(arg), Ok(None) => StringSlice::from_str(""), diff --git a/crates/fj/src/abi/ffi_safe.rs b/crates/fj/src/abi/ffi_safe.rs index a7df4858e..47dac10ab 100644 --- a/crates/fj/src/abi/ffi_safe.rs +++ b/crates/fj/src/abi/ffi_safe.rs @@ -173,7 +173,7 @@ impl Deref for String { fn deref(&self) -> &Self::Target { // Safety: The only way to create a FfiSafeString is from a valid Rust // string, so we can skip the UTF-8 checks. - unsafe { std::str::from_utf8_unchecked(&*self.0) } + unsafe { std::str::from_utf8_unchecked(&self.0) } } } @@ -296,7 +296,7 @@ impl Deref for StringSlice { fn deref(&self) -> &Self::Target { // Safety: the only way you can construct a StringSlice is via a string. - unsafe { std::str::from_utf8_unchecked(&*self.0) } + unsafe { std::str::from_utf8_unchecked(&self.0) } } } diff --git a/crates/fj/src/abi/mod.rs b/crates/fj/src/abi/mod.rs index 132c781e4..9309bfe07 100644 --- a/crates/fj/src/abi/mod.rs +++ b/crates/fj/src/abi/mod.rs @@ -121,7 +121,7 @@ fn on_panic(payload: Box) -> ! { if let Some(s) = payload.downcast_ref::() { s.as_str() } else if let Some(s) = payload.downcast_ref::<&str>() { - *s + s } else { "A panic occurred" }; From c06c25f8f69558eb270b3bc73059c61f6331912e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 4 Nov 2022 09:46:16 +0100 Subject: [PATCH 2/2] Upgrade to Rust 1.65.0 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 49b8a0197..b314ae52a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.64.0" +channel = "1.65.0" components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"]