Skip to content

Commit df0f61a

Browse files
seadandaliamaharon
andauthored
Fix clippy lints behind feature gates and add new CI step all features (#2569)
Many clippy lints usually enforced by `-Dcomplexity` and `-Dcorrectness` are not caught by CI as they are gated by `features`, like `runtime-benchmarks`, while the clippy CI job runs with only the default features for all targets. This PR also adds a CI step to run clippy with `--all-features` to ensure the code quality is maintained behind feature gates from now on. To improve local development, clippy lints are downgraded to warnings, but they still will result in an error at CI due to the `-Dwarnings` rustflag. --------- Co-authored-by: Liam Aharon <[email protected]>
1 parent 13ff299 commit df0f61a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pallet-xcm-benchmarks/src/generic/benchmarking.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ benchmarks! {
175175
descend_origin {
176176
let mut executor = new_executor::<T>(Default::default());
177177
let who = X2(OnlyChild, OnlyChild);
178-
let instruction = Instruction::DescendOrigin(who.clone());
178+
let instruction = Instruction::DescendOrigin(who);
179179
let xcm = Xcm(vec![instruction]);
180180
} : {
181181
executor.bench_process(xcm)?;
@@ -242,7 +242,7 @@ benchmarks! {
242242
&origin,
243243
assets.clone().into(),
244244
&XcmContext {
245-
origin: Some(origin.clone()),
245+
origin: Some(origin),
246246
message_id: [0; 32],
247247
topic: None,
248248
},
@@ -279,7 +279,7 @@ benchmarks! {
279279
let origin = T::subscribe_origin()?;
280280
let query_id = Default::default();
281281
let max_response_weight = Default::default();
282-
let mut executor = new_executor::<T>(origin.clone());
282+
let mut executor = new_executor::<T>(origin);
283283
let instruction = Instruction::SubscribeVersion { query_id, max_response_weight };
284284
let xcm = Xcm(vec![instruction]);
285285
} : {
@@ -299,14 +299,14 @@ benchmarks! {
299299
query_id,
300300
max_response_weight,
301301
&XcmContext {
302-
origin: Some(origin.clone()),
302+
origin: Some(origin),
303303
message_id: [0; 32],
304304
topic: None,
305305
},
306306
).map_err(|_| "Could not start subscription")?;
307307
assert!(<T::XcmConfig as xcm_executor::Config>::SubscriptionService::is_subscribed(&origin));
308308

309-
let mut executor = new_executor::<T>(origin.clone());
309+
let mut executor = new_executor::<T>(origin);
310310
let instruction = Instruction::UnsubscribeVersion;
311311
let xcm = Xcm(vec![instruction]);
312312
} : {
@@ -538,7 +538,7 @@ benchmarks! {
538538

539539
let mut executor = new_executor::<T>(origin);
540540

541-
let instruction = Instruction::UniversalOrigin(alias.clone());
541+
let instruction = Instruction::UniversalOrigin(alias);
542542
let xcm = Xcm(vec![instruction]);
543543
}: {
544544
executor.bench_process(xcm)?;
@@ -632,13 +632,13 @@ benchmarks! {
632632

633633
let (unlocker, owner, asset) = T::unlockable_asset()?;
634634

635-
let mut executor = new_executor::<T>(unlocker.clone());
635+
let mut executor = new_executor::<T>(unlocker);
636636

637637
// We first place the asset in lock first...
638638
<T::XcmConfig as xcm_executor::Config>::AssetLocker::prepare_lock(
639639
unlocker,
640640
asset.clone(),
641-
owner.clone(),
641+
owner,
642642
)
643643
.map_err(|_| BenchmarkError::Skip)?
644644
.enact()
@@ -658,13 +658,13 @@ benchmarks! {
658658

659659
let (unlocker, owner, asset) = T::unlockable_asset()?;
660660

661-
let mut executor = new_executor::<T>(unlocker.clone());
661+
let mut executor = new_executor::<T>(unlocker);
662662

663663
// We first place the asset in lock first...
664664
<T::XcmConfig as xcm_executor::Config>::AssetLocker::prepare_lock(
665665
unlocker,
666666
asset.clone(),
667-
owner.clone(),
667+
owner,
668668
)
669669
.map_err(|_| BenchmarkError::Skip)?
670670
.enact()
@@ -686,9 +686,9 @@ benchmarks! {
686686

687687
// We first place the asset in lock first...
688688
<T::XcmConfig as xcm_executor::Config>::AssetLocker::prepare_lock(
689-
locker.clone(),
689+
locker,
690690
asset.clone(),
691-
owner.clone(),
691+
owner,
692692
)
693693
.map_err(|_| BenchmarkError::Skip)?
694694
.enact()
@@ -739,7 +739,7 @@ benchmarks! {
739739

740740
let mut executor = new_executor::<T>(origin);
741741

742-
let instruction = Instruction::AliasOrigin(target.clone());
742+
let instruction = Instruction::AliasOrigin(target);
743743
let xcm = Xcm(vec![instruction]);
744744
}: {
745745
executor.bench_process(xcm)?;

xcm-simulator/example/src/parachain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl EnsureOriginWithArg<RuntimeOrigin, MultiLocation> for ForeignCreators {
164164

165165
#[cfg(feature = "runtime-benchmarks")]
166166
fn try_successful_origin(a: &MultiLocation) -> Result<RuntimeOrigin, ()> {
167-
Ok(pallet_xcm::Origin::Xcm(a.clone()).into())
167+
Ok(pallet_xcm::Origin::Xcm(*a).into())
168168
}
169169
}
170170

0 commit comments

Comments
 (0)