diff --git a/common/numerated/src/interval.rs b/common/numerated/src/interval.rs index 0b1df24d62e..982aadecc7c 100644 --- a/common/numerated/src/interval.rs +++ b/common/numerated/src/interval.rs @@ -441,7 +441,7 @@ mod tests { #[test] fn size() { assert_eq!(Interval::::try_from(11..111).unwrap().size(), Some(100),); - assert_eq!(Interval::::try_from(..1).unwrap().size(), Some(1),); + assert_eq!(Interval::::from(..1).size(), Some(1),); assert_eq!(Interval::::from(..=1).size(), Some(2)); assert_eq!(Interval::::from(1..).size(), Some(255)); assert_eq!(Interval::::from(0..).size(), None); @@ -452,7 +452,7 @@ mod tests { Interval::::try_from(11..111).unwrap().raw_size(), Some(100), ); - assert_eq!(Interval::::try_from(..1).unwrap().raw_size(), Some(1),); + assert_eq!(Interval::::from(..1).raw_size(), Some(1),); assert_eq!(Interval::::from(..=1).raw_size(), Some(2)); assert_eq!(Interval::::from(1..).raw_size(), Some(255)); assert_eq!(Interval::::from(0..).raw_size(), None); @@ -460,7 +460,7 @@ mod tests { assert_eq!(Interval::::try_from(1..1).unwrap().raw_size(), Some(0)); assert_eq!(Interval::::try_from(-1..99).unwrap().size(), Some(-28)); // corresponds to 100 numeration - assert_eq!(Interval::::try_from(..1).unwrap().size(), Some(1)); // corresponds to 129 numeration + assert_eq!(Interval::::from(..1).size(), Some(1)); // corresponds to 129 numeration assert_eq!(Interval::::from(..=1).size(), Some(2)); // corresponds to 130 numeration assert_eq!(Interval::::from(1..).size(), Some(-1)); // corresponds to 127 numeration assert_eq!(Interval::::from(0..).size(), Some(0)); // corresponds to 128 numeration @@ -471,7 +471,7 @@ mod tests { Interval::::try_from(-1..99).unwrap().raw_size(), Some(100) ); - assert_eq!(Interval::::try_from(..1).unwrap().raw_size(), Some(129)); + assert_eq!(Interval::::from(..1).raw_size(), Some(129)); assert_eq!(Interval::::from(..=1).raw_size(), Some(130)); assert_eq!(Interval::::from(1..).raw_size(), Some(127)); assert_eq!(Interval::::from(0..).raw_size(), Some(128)); diff --git a/common/src/gas_provider/property_tests/mod.rs b/common/src/gas_provider/property_tests/mod.rs index 314852c3cf6..e6782739b97 100644 --- a/common/src/gas_provider/property_tests/mod.rs +++ b/common/src/gas_provider/property_tests/mod.rs @@ -94,7 +94,7 @@ type Balance = u64; type Funds = u128; std::thread_local! { - static TOTAL_ISSUANCE: RefCell> = RefCell::new(None); + static TOTAL_ISSUANCE: RefCell> = const { RefCell::new(None) }; } #[derive(Debug, PartialEq, Eq)] @@ -177,7 +177,7 @@ impl From for GasNodeId { } std::thread_local! { - static GAS_TREE_NODES: RefCell> = RefCell::new(BTreeMap::new()); + static GAS_TREE_NODES: RefCell> = const { RefCell::new(BTreeMap::new()) }; } struct GasTreeNodesWrap; diff --git a/examples/constructor/src/builder.rs b/examples/constructor/src/builder.rs index fd9f9e5209f..fe1d1ffd078 100644 --- a/examples/constructor/src/builder.rs +++ b/examples/constructor/src/builder.rs @@ -46,8 +46,6 @@ impl Calls { self } - // TODO #3452: remove this on next rust update - #[allow(clippy::useless_conversion)] pub fn add_from_iter(mut self, calls: impl Iterator) -> Self { self.0.extend(calls.into_iter()); self diff --git a/examples/constructor/src/wasm.rs b/examples/constructor/src/wasm.rs index 3848d0516ef..6377f1bd13b 100644 --- a/examples/constructor/src/wasm.rs +++ b/examples/constructor/src/wasm.rs @@ -7,7 +7,7 @@ static mut SCHEME: Option = None; fn process_fn<'a>(f: impl Fn(&'a Scheme) -> Option<&'a Vec>) { let scheme = unsafe { SCHEME.as_ref() }.expect("Should be set before access"); let calls = f(scheme) - .map(Clone::clone) + .cloned() .unwrap_or_else(|| msg::load().expect("Failed to load payload")); let mut res = None; diff --git a/examples/fungible-token/src/wasm.rs b/examples/fungible-token/src/wasm.rs index 040c2db639f..0fa19db952a 100644 --- a/examples/fungible-token/src/wasm.rs +++ b/examples/fungible-token/src/wasm.rs @@ -170,10 +170,10 @@ extern "C" fn state() { decimals, } = state; - let balances = balances.into_iter().map(|(k, v)| (k, v)).collect(); + let balances = balances.into_iter().collect(); let allowances = allowances .into_iter() - .map(|(id, allowance)| (id, allowance.into_iter().map(|(k, v)| (k, v)).collect())) + .map(|(id, allowance)| (id, allowance.into_iter().collect())) .collect(); let payload = IoFungibleToken { name, diff --git a/examples/fungible-token/tests/benchmarks.rs b/examples/fungible-token/tests/benchmarks.rs index 9d94cd9f0da..2818e3ac42e 100644 --- a/examples/fungible-token/tests/benchmarks.rs +++ b/examples/fungible-token/tests/benchmarks.rs @@ -92,7 +92,7 @@ async fn stress_test() -> Result<()> { .encode(); let (message_id, program_id, _hash) = api - .upload_program_bytes(WASM_BINARY.to_vec(), [137u8], init_msg, MAX_GAS_LIMIT, 0) + .upload_program_bytes(WASM_BINARY, [137u8], init_msg, MAX_GAS_LIMIT, 0) .await?; assert!(listener.message_processed(message_id).await?.succeed()); @@ -229,7 +229,7 @@ async fn stress_transfer() -> Result<()> { let salt: u8 = rng.gen(); let (message_id, program_id, _hash) = api - .upload_program_bytes(WASM_BINARY.to_vec(), [salt], init_msg, MAX_GAS_LIMIT, 0) + .upload_program_bytes(WASM_BINARY, [salt], init_msg, MAX_GAS_LIMIT, 0) .await .unwrap(); diff --git a/examples/new-meta/src/wasm.rs b/examples/new-meta/src/wasm.rs index 906aaee1b44..ff62c7830a0 100644 --- a/examples/new-meta/src/wasm.rs +++ b/examples/new-meta/src/wasm.rs @@ -27,7 +27,7 @@ extern "C" fn handle() { let res = unsafe { &WALLETS } .iter() .find(|w| w.id.decimal == message_in.id.decimal) - .map(Clone::clone); + .cloned(); let message_out = MessageOut { res }; diff --git a/examples/node/src/wasm.rs b/examples/node/src/wasm.rs index aaa4a7d8cac..bb7a00aefac 100644 --- a/examples/node/src/wasm.rs +++ b/examples/node/src/wasm.rs @@ -143,7 +143,7 @@ fn process(request: Request) -> Reply { transition.query_list = state().sub_nodes.iter().cloned().collect(); let first_sub_node = *transition .query_list - .get(0) + .first() .expect("Checked above that sub_nodes is not empty; qed"); transition.last_sent_message_id = msg::send(first_sub_node, request, 0).unwrap(); @@ -176,7 +176,7 @@ fn process(request: Request) -> Reply { if let TransitionState::Ready = transition.state { let first_sub_node = *transition .query_list - .get(0) + .first() .expect("Checked above that sub_nodes is not empty; qed"); transition.query_index = 0; diff --git a/gcli/tests/common/mod.rs b/gcli/tests/common/mod.rs index e1f33e846f2..380aa2917d5 100644 --- a/gcli/tests/common/mod.rs +++ b/gcli/tests/common/mod.rs @@ -17,17 +17,12 @@ // along with this program. If not, see . //! Common utils for integration tests -pub use self::{ - args::Args, - node::{Convert, NodeExec}, - result::{Error, Result}, -}; +pub use self::{args::Args, node::NodeExec, result::Result}; use gear_core::ids::{CodeId, ProgramId}; use gsdk::{ ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32}, testing::Node, }; -pub use scale_info::scale::Encode; use std::{ iter::IntoIterator, process::{Command, Output}, diff --git a/gclient/src/api/listener/mod.rs b/gclient/src/api/listener/mod.rs index 840a6f10990..297a1fa8257 100644 --- a/gclient/src/api/listener/mod.rs +++ b/gclient/src/api/listener/mod.rs @@ -21,7 +21,6 @@ mod subscription; pub use gsdk::metadata::{gear::Event as GearEvent, Event}; pub use iterator::*; -pub use subscription::*; use crate::{Error, Result}; use async_trait::async_trait; diff --git a/gclient/src/api/storage/mod.rs b/gclient/src/api/storage/mod.rs index 8d0b31e9198..7df65cf6211 100644 --- a/gclient/src/api/storage/mod.rs +++ b/gclient/src/api/storage/mod.rs @@ -19,8 +19,6 @@ pub(crate) mod account_id; mod block; -pub use block::*; - use super::{GearApi, Result}; use crate::Error; use account_id::IntoAccountId32; diff --git a/gclient/src/lib.rs b/gclient/src/lib.rs index a8d4bc43fac..fd433c59fb6 100644 --- a/gclient/src/lib.rs +++ b/gclient/src/lib.rs @@ -135,7 +135,7 @@ mod api; mod utils; mod ws; -pub use api::{calls::*, error::*, listener::*, GearApi}; +pub use api::{error::*, listener::*, GearApi}; pub use gsdk::metadata::errors; pub use utils::*; pub use ws::WSAddress; diff --git a/gsdk/src/storage.rs b/gsdk/src/storage.rs index 2d002bb6cee..45bfe2b8385 100644 --- a/gsdk/src/storage.rs +++ b/gsdk/src/storage.rs @@ -360,8 +360,7 @@ impl Api { ], ); - let data: Option<(UserStoredMessage, Interval)> = self.fetch_storage(&addr).await.ok(); - Ok(data.map(|(m, i)| (m, i))) + Ok(self.fetch_storage(&addr).await.ok()) } /// Get all mailbox messages or for the provided `address`. diff --git a/gsdk/src/testing/node.rs b/gsdk/src/testing/node.rs index c478e401873..64414401b48 100644 --- a/gsdk/src/testing/node.rs +++ b/gsdk/src/testing/node.rs @@ -78,7 +78,10 @@ impl Node { return Err(Error::EmptyStderr); }; - for line in BufReader::new(stderr).lines().flatten() { + for line in BufReader::new(stderr) + .lines() + .map_while(|result| result.ok()) + { if line.contains(log) { return Ok(line); } @@ -91,7 +94,7 @@ impl Node { pub fn print_logs(&mut self) { let stderr = self.process.stderr.as_mut(); let reader = BufReader::new(stderr.expect("Unable to get stderr")); - for line in reader.lines().flatten() { + for line in reader.lines().map_while(|result| result.ok()) { println!("{line}"); } } diff --git a/gstd/src/async_runtime/signals.rs b/gstd/src/async_runtime/signals.rs index 3eff1f804df..88d310f8e28 100644 --- a/gstd/src/async_runtime/signals.rs +++ b/gstd/src/async_runtime/signals.rs @@ -89,7 +89,7 @@ impl WakeSignals { self.signals.contains_key(&reply_to) } - pub fn poll(&mut self, reply_to: MessageId, cx: &Context<'_>) -> ReplyPoll { + pub fn poll(&mut self, reply_to: MessageId, cx: &mut Context<'_>) -> ReplyPoll { match self.signals.remove(&reply_to) { None => ReplyPoll::None, Some(mut signal @ WakeSignal { payload: None, .. }) => { diff --git a/gstd/src/macros/debug.rs b/gstd/src/macros/debug.rs index 4d2b423540b..06c697ba607 100644 --- a/gstd/src/macros/debug.rs +++ b/gstd/src/macros/debug.rs @@ -69,14 +69,15 @@ macro_rules! debug { #[macro_export] macro_rules! dbg { () => { - $crate::debug!("[{}:{}]", $crate::prelude::file!(), $crate::prelude::line!()) + $crate::debug!("[{}:{}:{}]", $crate::prelude::file!(), $crate::prelude::line!(), $crate::prelude::column!()) }; ($val:expr $(,)?) => { match $val { tmp => { - $crate::debug!("[{}:{}] {} = {:#?}", + $crate::debug!("[{}:{}:{}] {} = {:#?}", $crate::prelude::file!(), $crate::prelude::line!(), + $crate::prelude::column!(), $crate::prelude::stringify!($val), &tmp, ); diff --git a/gstd/src/msg/async.rs b/gstd/src/msg/async.rs index adcbd7ee9f8..5d78ec43296 100644 --- a/gstd/src/msg/async.rs +++ b/gstd/src/msg/async.rs @@ -32,7 +32,7 @@ use core::{ use futures::future::FusedFuture; use scale_info::scale::Decode; -fn poll(waiting_reply_to: MessageId, cx: &Context<'_>, f: F) -> Poll> +fn poll(waiting_reply_to: MessageId, cx: &mut Context<'_>, f: F) -> Poll> where F: Fn(Vec) -> Result, { diff --git a/gstd/tests/debug.rs b/gstd/tests/debug.rs index f01eeda4eab..4664d50fdf5 100644 --- a/gstd/tests/debug.rs +++ b/gstd/tests/debug.rs @@ -13,6 +13,7 @@ mod sys { } #[test] +#[allow(static_mut_ref)] fn test_debug() { let value = 42; @@ -28,6 +29,6 @@ fn test_debug() { crate::dbg!(value); assert_eq!( unsafe { &DEBUG_MSG }, - b"[gstd/tests/debug.rs:28] value = 42" + b"[gstd/tests/debug.rs:29:5] value = 42" ); } diff --git a/pallets/gear-voucher/src/benchmarking.rs b/pallets/gear-voucher/src/benchmarking.rs index b803b6ff906..77a8246cb8e 100644 --- a/pallets/gear-voucher/src/benchmarking.rs +++ b/pallets/gear-voucher/src/benchmarking.rs @@ -35,7 +35,7 @@ benchmarks! { issue { // Origin account. let origin = benchmarking::account::("origin", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &origin, 100_000_000_000_000_u128.unique_saturated_into() ); @@ -72,7 +72,7 @@ benchmarks! { revoke { // Origin account. let origin = benchmarking::account::("origin", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &origin, 100_000_000_000_000_u128.unique_saturated_into() ); @@ -102,7 +102,7 @@ benchmarks! { update { // Origin account. let origin = benchmarking::account::("origin", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &origin, 100_000_000_000_000_u128.unique_saturated_into() ); diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 5ab9ebfc892..89b614a5b7b 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -423,9 +423,9 @@ benchmarks! { claim_value { let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); let program_id = benchmarking::account::("program", 0, 100); - CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); let code = benchmarking::generate_wasm(16.into()).unwrap(); benchmarking::set_program::, _>(program_id.clone().cast(), code, 1.into()); let original_message_id = benchmarking::account::("message", 0, 100).cast(); @@ -527,7 +527,7 @@ benchmarks! { send_message { let p in 0 .. MAX_PAYLOAD_LEN; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); let minimum_balance = CurrencyOf::::minimum_balance(); let program_id = benchmarking::account::("program", 0, 100).cast(); let code = benchmarking::generate_wasm(16.into()).unwrap(); @@ -543,10 +543,10 @@ benchmarks! { send_reply { let p in 0 .. MAX_PAYLOAD_LEN; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); let minimum_balance = CurrencyOf::::minimum_balance(); let program_id = benchmarking::account::("program", 0, 100); - CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); let code = benchmarking::generate_wasm(16.into()).unwrap(); benchmarking::set_program::, _>(program_id.clone().cast(), code, 1.into()); let original_message_id = benchmarking::account::("message", 0, 100).cast(); diff --git a/pallets/gear/src/benchmarking/tasks.rs b/pallets/gear/src/benchmarking/tasks.rs index 0107a1409d0..c94c6f1de48 100644 --- a/pallets/gear/src/benchmarking/tasks.rs +++ b/pallets/gear/src/benchmarking/tasks.rs @@ -25,7 +25,8 @@ where use demo_delayed_sender::WASM_BINARY; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let _ = + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); init_block::(None); @@ -53,7 +54,8 @@ where use demo_reserve_gas::{InitAction, WASM_BINARY}; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let _ = + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); init_block::(None); @@ -120,7 +122,8 @@ where use demo_constructor::{Call, Calls, Scheme, WASM_BINARY}; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let _ = + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); init_block::(None); @@ -176,7 +179,8 @@ where use demo_waiter::{Command, WaitSubcommand, WASM_BINARY}; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let _ = + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); init_block::(None); @@ -226,7 +230,8 @@ where use demo_waiter::{Command, WaitSubcommand, WASM_BINARY}; let caller = benchmarking::account("caller", 0, 0); - CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let _ = + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); init_block::(None); diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index ae128871788..b7be7a58668 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -50,7 +50,7 @@ where utils::init_logger(); let origin = benchmarking::account::("origin", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &origin, 100_000_000_000_000_000_u128.unique_saturated_into(), ); @@ -145,7 +145,10 @@ where utils::init_logger(); let origin = benchmarking::account::("origin", 0, 0); - CurrencyOf::::deposit_creating(&origin, 5_000_000_000_000_000_u128.unique_saturated_into()); + let _ = CurrencyOf::::deposit_creating( + &origin, + 5_000_000_000_000_000_u128.unique_saturated_into(), + ); let salt = b"signal_stack_limit_exceeded_works salt"; @@ -440,7 +443,7 @@ where let wasm_module = alloc_free_test_wasm::(); let default_account = utils::default_account(); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &default_account, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -532,7 +535,7 @@ where { run_tester::(|_, _| { let message_sender = benchmarking::account::("some_user", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &message_sender, 50_000_000_000_000_u128.unique_saturated_into(), ); @@ -1057,7 +1060,7 @@ where // Deploy program with valid code hash let child_deployer = benchmarking::account::("child_deployer", 0, 0); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &child_deployer, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -1074,7 +1077,7 @@ where // Set default code-hash for create program calls let default_account = utils::default_account(); - CurrencyOf::::deposit_creating( + let _ = CurrencyOf::::deposit_creating( &default_account, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -1135,7 +1138,7 @@ where // Manually reset the storage Gear::::reset(); - CurrencyOf::::slash( + let _ = CurrencyOf::::slash( &tester_pid.cast(), CurrencyOf::::free_balance(&tester_pid.cast()), ); diff --git a/pallets/gear/src/manager/mod.rs b/pallets/gear/src/manager/mod.rs index fb047ccb744..fa6ecf7675a 100644 --- a/pallets/gear/src/manager/mod.rs +++ b/pallets/gear/src/manager/mod.rs @@ -49,7 +49,6 @@ mod journal; mod task; use gear_core_errors::{ReplyCode, SignalCode}; -pub use journal::*; pub use task::*; use crate::{ diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index b2e88593176..b56e1ac1919 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -113,7 +113,7 @@ parameter_types! { } thread_local! { - static SCHEDULE: RefCell>> = RefCell::new(None); + static SCHEDULE: RefCell>> = const { RefCell::new(None) }; } #[derive(Debug)] diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index bf6615310f3..4403ba7c724 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -71,7 +71,10 @@ where .saturating_add(value_for_gas) .saturating_add(value); - CurrencyOf::::deposit_creating(&origin, required_balance.saturating_sub(origin_balance)); + let _ = CurrencyOf::::deposit_creating( + &origin, + required_balance.saturating_sub(origin_balance), + ); let who = frame_support::dispatch::RawOrigin::Signed(origin); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 6969befd0f2..5c7b29cb528 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -14845,7 +14845,7 @@ mod utils { let mut found_status: Option = None; System::events().iter().for_each(|e| { if let MockRuntimeEvent::Gear(Event::MessagesDispatched { statuses, .. }) = &e.event { - found_status = statuses.get(&message_id).map(Clone::clone); + found_status = statuses.get(&message_id).cloned(); } }); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 3446f6a974b..6c4fbfbec55 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -270,8 +270,7 @@ impl pallet_babe::Config for Runtime { type WeightInfo = (); type MaxAuthorities = MaxAuthorities; - type KeyOwnerProof = - >::Proof; + type KeyOwnerProof = sp_session::MembershipProof; type EquivocationReportSystem = pallet_babe::EquivocationReportSystem; } @@ -282,7 +281,7 @@ impl pallet_grandpa::Config for Runtime { type WeightInfo = (); type MaxAuthorities = MaxAuthorities; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; - type KeyOwnerProof = >::Proof; + type KeyOwnerProof = sp_session::MembershipProof; type EquivocationReportSystem = pallet_grandpa::EquivocationReportSystem; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a7adebc0c1e..083e594e40c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-09-05" +channel = "nightly-2024-01-25" components = [ "llvm-tools" ] targets = [ "wasm32-unknown-unknown" ] profile = "default" diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs index 72958d47e49..b2d2fdd41ba 100644 --- a/sandbox/host/src/sandbox.rs +++ b/sandbox/host/src/sandbox.rs @@ -538,6 +538,7 @@ impl Store
{ /// /// Returns `Err` If `instance_idx` isn't a valid index of an instance or /// instance is already torndown. + #[allow(clippy::useless_asref)] pub fn instance(&self, instance_idx: u32) -> Result>> { self.instances .get(instance_idx as usize) @@ -553,6 +554,7 @@ impl Store
{ /// /// Returns `Err` If `instance_idx` isn't a valid index of an instance or /// instance is already torndown. + #[allow(clippy::useless_asref)] pub fn dispatch_thunk(&self, instance_idx: u32) -> Result
{ self.instances .get(instance_idx as usize) diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index c650a02310a..45396f15a6b 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -533,7 +533,6 @@ impl MemoryWrapper { /// See `[memory_as_slice]`. In addition to those requirements, since a mutable reference is /// returned it must be ensured that only one mutable and no shared references to memory /// exists at the same time. - #[allow(clippy::needless_pass_by_ref_mut)] unsafe fn memory_as_slice_mut(memory: &mut sandbox_wasmer::Memory) -> &mut [u8] { let ptr = memory.data_ptr(); diff --git a/scripts/src/clippy.sh b/scripts/src/clippy.sh index 5a381a2c3c8..9f33610254d 100755 --- a/scripts/src/clippy.sh +++ b/scripts/src/clippy.sh @@ -20,14 +20,13 @@ EOF } gear_clippy() { - # TODO #3452: remove `-A clippy::needless_pass_by_ref_mut`, `-A clippy::assertions_on_constants` on next rust update EXCLUDE_PACKAGES="--exclude vara-runtime --exclude runtime-fuzzer --exclude runtime-fuzzer-fuzz" INCLUDE_PACKAGES="-p vara-runtime -p runtime-fuzzer -p runtime-fuzzer-fuzz" - __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy --workspace "$@" $EXCLUDE_PACKAGES -- --no-deps -D warnings -A clippy::needless_pass_by_ref_mut -A clippy::assertions_on_constants - __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy $INCLUDE_PACKAGES --all-features -- --no-deps -D warnings -A clippy::needless_pass_by_ref_mut -A clippy::assertions_on_constants + __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy --workspace "$@" $EXCLUDE_PACKAGES -- --no-deps -D warnings + __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy $INCLUDE_PACKAGES --all-features -- --no-deps -D warnings } examples_clippy() { - __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy -p "demo-*" -p test-syscalls --no-default-features "$@" -- --no-deps -D warnings -A clippy::needless_pass_by_ref_mut -A clippy::assertions_on_constants + __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 cargo clippy -p "demo-*" -p test-syscalls --no-default-features "$@" -- --no-deps -D warnings -A static_mut_ref } diff --git a/utils/gear-replay-cli/src/lib.rs b/utils/gear-replay-cli/src/lib.rs index 81885e0bd4a..128c7563bcf 100644 --- a/utils/gear-replay-cli/src/lib.rs +++ b/utils/gear-replay-cli/src/lib.rs @@ -103,7 +103,7 @@ pub async fn run() -> sc_cli::Result<()> { true => VARA_SS58_PREFIX, false => GEAR_SS58_PREFIX, }; - sp_core::crypto::set_default_ss58_version(ss58_prefix.try_into().unwrap()); + sp_core::crypto::set_default_ss58_version(ss58_prefix.into()); match &options.command { Command::ReplayBlock(cmd) => { diff --git a/utils/gring/src/keystore.rs b/utils/gring/src/keystore.rs index b027d944a6f..adf62ca111c 100644 --- a/utils/gring/src/keystore.rs +++ b/utils/gring/src/keystore.rs @@ -190,7 +190,7 @@ impl Encoding { /// Check if is encoding with scrypt. pub fn is_scrypt(&self) -> bool { - self.ty.get(0) == Some(&"scrypt".into()) + self.ty.first() == Some(&"scrypt".into()) } /// Check if the cipher is xsalsa20-poly1305. diff --git a/utils/runtime-fuzzer/src/runtime/mod.rs b/utils/runtime-fuzzer/src/runtime/mod.rs index a18d94364a9..17d5f79c9d2 100644 --- a/utils/runtime-fuzzer/src/runtime/mod.rs +++ b/utils/runtime-fuzzer/src/runtime/mod.rs @@ -29,7 +29,7 @@ use vara_runtime::{ }; pub use account::{account, alice, BalanceManager, BalanceState}; -pub use block::{default_gas_limit, run_to_block, run_to_next_block}; +pub use block::{default_gas_limit, run_to_next_block}; mod account; mod block; diff --git a/utils/validator-checks/src/blocks_production.rs b/utils/validator-checks/src/blocks_production.rs index 3a251fc95b9..7635df4cb08 100644 --- a/utils/validator-checks/src/blocks_production.rs +++ b/utils/validator-checks/src/blocks_production.rs @@ -35,7 +35,7 @@ impl BlocksProduction { } let logs = &block.header().digest.logs; - if let Some(DigestItem::PreRuntime(engine, bytes)) = logs.get(0) { + if let Some(DigestItem::PreRuntime(engine, bytes)) = logs.first() { if *engine == BABE_ENGINE_ID { if let Some(author) = BabePreDigest::decode(&mut bytes.as_ref()) .ok() diff --git a/utils/validator-checks/src/result.rs b/utils/validator-checks/src/result.rs index feb286d403c..fe91997c943 100644 --- a/utils/validator-checks/src/result.rs +++ b/utils/validator-checks/src/result.rs @@ -15,7 +15,7 @@ pub enum Error { EnvLogger(#[from] log::SetLoggerError), /// Decoding ss58 address failed. #[error(transparent)] - PublicError(#[from] gsdk::ext::sp_core::crypto::PublicError), + PublicKey(#[from] gsdk::ext::sp_core::crypto::PublicError), /// Blocks production validation failed. #[error("Some validators didn't produce blocks.")] BlocksProduction, diff --git a/utils/wasm-builder/src/cargo_toolchain.rs b/utils/wasm-builder/src/cargo_toolchain.rs index 5fc6ab8fccb..9ed62ff3f5b 100644 --- a/utils/wasm-builder/src/cargo_toolchain.rs +++ b/utils/wasm-builder/src/cargo_toolchain.rs @@ -36,7 +36,7 @@ pub(crate) struct Toolchain(String); impl Toolchain { /// This is a version of nightly toolchain, tested on our CI. - const PINNED_NIGHTLY_TOOLCHAIN: &'static str = "nightly-2023-09-05"; + const PINNED_NIGHTLY_TOOLCHAIN: &'static str = "nightly-2024-01-25"; /// Returns `Toolchain` representing the recommended nightly version. pub fn recommended_nightly() -> Self {