From 86acf32fa8e0a181e7557271729c7825cc9fd539 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Sat, 9 Sep 2023 15:11:02 +0200 Subject: [PATCH] chore: Fix warnings --- base/src/fixed.rs | 2 +- scripts/install_mdbook.sh | 7 +------ vm/src/lazy.rs | 4 ++-- vm/src/thread.rs | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/base/src/fixed.rs b/base/src/fixed.rs index 5382346a56..21c61f4a3c 100644 --- a/base/src/fixed.rs +++ b/base/src/fixed.rs @@ -400,7 +400,7 @@ impl Buffer { // SAFETY This effectively works as a RefCell since the mutable reference is limited to // this module unsafe { - let mut values = self.values.unsafe_get_mut(); + let values = self.values.unsafe_get_mut(); let cap = match values.current().map(|vec| (vec.len(), vec.capacity())) { Some((len, capacity)) => { if len == capacity { diff --git a/scripts/install_mdbook.sh b/scripts/install_mdbook.sh index 59b0322af6..f1288b4614 100755 --- a/scripts/install_mdbook.sh +++ b/scripts/install_mdbook.sh @@ -2,11 +2,6 @@ set -ex -#Getting issue error: unrecognized subcommand '/home/travis/.rustup/toolchains/nightly-2023-09-05-x86_64-unknown-linux-gnu/bin/rustc' -ls /home/travis/.rustup/toolchains/nightly-2023-09-05-x86_64-unknown-linux-gnu/bin/* -/home/travis/.rustup/toolchains/nightly-2023-09-05-x86_64-unknown-linux-gnu/bin/rustc --version - - if [[ $1 == *"apple"* ]]; then exit 0 @@ -17,4 +12,4 @@ fi MDBOOK_VERSION="mdbook-v0.2.1-${TARGET}" curl -L "https://github.com/rust-lang-nursery/mdBook/releases/download/v0.2.1/$MDBOOK_VERSION.tar.gz" | tar -xvz chmod +x ./mdbook -mv ./mdbook $HOME/bin/ +mv ./mdbook $HOME/bin/ diff --git a/vm/src/lazy.rs b/vm/src/lazy.rs index 55425dc71a..3065bad7d1 100644 --- a/vm/src/lazy.rs +++ b/vm/src/lazy.rs @@ -166,7 +166,7 @@ fn force( let lazy_lock = lazy.value.lock().unwrap(); match *lazy_lock { Lazy_::Value(ref value) => { - vm.current_context().push(value.clone()); + vm.current_context().push(value); Pushed::default() } _ => unreachable!(), @@ -176,7 +176,7 @@ fn force( )) } Lazy_::Value(ref value) => { - vm.current_context().push(value.clone()); + vm.current_context().push(value); Either::Left(future::ready(RuntimeResult::Return(Pushed::default()))) } _ => unreachable!(), diff --git a/vm/src/thread.rs b/vm/src/thread.rs index 505e26c036..a8b96e74ff 100644 --- a/vm/src/thread.rs +++ b/vm/src/thread.rs @@ -574,18 +574,18 @@ impl<'de, 'gc> serde::de::DeserializeState<'de, crate::serialization::DeSeed<'gc impl Drop for Thread { fn drop(&mut self) { - // The child threads need to refer to `self` so drop the gc (and thus the child threads) - // first so that `self` is valid while dropping them - let context = self.context.get_mut().unwrap_or_else(|err| { - // Ignore poisoning since we don't need to interact with the Gc values, only - // drop them - err.into_inner() - }); - let mut gc_to_drop = - ::std::mem::replace(&mut context.gc, Gc::new(Generation::default(), 0)); - // Make sure that the RefMut is dropped before the Gc itself as the RwLock is dropped + // Make sure that context reference is dropped before the Gc itself as the RwLock is dropped // when the Gc is dropped - drop(context); + let mut gc_to_drop = { + // The child threads need to refer to `self` so drop the gc (and thus the child threads) + // first so that `self` is valid while dropping them + let context = self.context.get_mut().unwrap_or_else(|err| { + // Ignore poisoning since we don't need to interact with the Gc values, only + // drop them + err.into_inner() + }); + ::std::mem::replace(&mut context.gc, Gc::new(Generation::default(), 0)) + }; // SAFETY GcPtr's may not leak outside of the `Thread` so we can safely clear it when // droppting the thread @@ -2574,7 +2574,7 @@ where where T: StackState, { - let stack = self.stack.enter_scope_excess(args, state.clone(), excess)?; + let stack = self.stack.enter_scope_excess(args, state, excess)?; self.hook.previous_instruction_index = usize::max_value(); Ok(ExecuteContext { thread: self.thread,