* Add clippy config and remove .cargo from gitignore

* first fixes

* Clippyfied

* Add clippy CI job

* comment out rusty-cachier

* minor

* fix ci

* remove DAG from check-dependent-project

* add DAG to clippy

Co-authored-by: alvicsam <alvicsam@gmail.com>
This commit is contained in:
alexgparity
2022-11-30 09:34:06 +01:00
committed by GitHub
parent b76086c617
commit 9ea14e66c8
67 changed files with 338 additions and 351 deletions
+1 -1
View File
@@ -1112,7 +1112,7 @@ impl<T: Config> Pallet<T> {
// it's sufficient to count the votes in the statement set after they
set.statements.iter().for_each(|(statement, v_i, _signature)| {
if Some(true) ==
summary.new_participants.get(v_i.0 as usize).map(|b| b.as_ref().clone())
summary.new_participants.get(v_i.0 as usize).map(|b| *b.as_ref())
{
match statement {
// `summary.new_flags` contains the spam free votes.
+3 -3
View File
@@ -751,10 +751,10 @@ impl<T: Config> Pallet<T> {
let ingress = <Self as Store>::HrmpIngressChannelsIndex::take(outgoing_para)
.into_iter()
.map(|sender| HrmpChannelId { sender, recipient: outgoing_para.clone() });
.map(|sender| HrmpChannelId { sender, recipient: *outgoing_para });
let egress = <Self as Store>::HrmpEgressChannelsIndex::take(outgoing_para)
.into_iter()
.map(|recipient| HrmpChannelId { sender: outgoing_para.clone(), recipient });
.map(|recipient| HrmpChannelId { sender: *outgoing_para, recipient });
let mut to_close = ingress.chain(egress).collect::<Vec<_>>();
to_close.sort();
to_close.dedup();
@@ -1075,7 +1075,7 @@ impl<T: Config> Pallet<T> {
channel.total_size += inbound.data.len() as u32;
// compute the new MQC head of the channel
let prev_head = channel.mqc_head.clone().unwrap_or(Default::default());
let prev_head = channel.mqc_head.unwrap_or(Default::default());
let new_head = BlakeTwo256::hash_of(&(
prev_head,
inbound.sent_at,
@@ -102,7 +102,7 @@ impl<H, N> CandidatePendingAvailability<H, N> {
/// Get the core index.
pub(crate) fn core_occupied(&self) -> CoreIndex {
self.core.clone()
self.core
}
/// Get the candidate hash.
@@ -383,7 +383,7 @@ impl<T: Config> Pallet<T> {
let mut freed_cores = Vec::with_capacity(expected_bits);
for (para_id, pending_availability) in assigned_paras_record
.into_iter()
.filter_map(|x| x)
.flatten()
.filter_map(|(id, p)| p.map(|p| (id, p)))
{
if pending_availability.availability_votes.count_ones() >= threshold {
@@ -644,8 +644,7 @@ impl<T: Config> Pallet<T> {
};
// one more sweep for actually writing to storage.
let core_indices =
core_indices_and_backers.iter().map(|&(ref c, _, _)| c.clone()).collect();
let core_indices = core_indices_and_backers.iter().map(|&(ref c, _, _)| *c).collect();
for (candidate, (core, backers, group)) in
candidates.into_iter().zip(core_indices_and_backers)
{
@@ -247,7 +247,7 @@ impl<T: Config> Pallet<T> {
let validators = shared::Pallet::<T>::initializer_on_new_session(
session_index,
random_seed.clone(),
random_seed,
&new_config,
all_validators,
);
@@ -513,7 +513,7 @@ impl<T: Config> Pallet<T> {
METRICS.on_candidates_sanitized(backed_candidates.len() as u64);
// Process backed candidates according to scheduled cores.
let parent_storage_root = parent_header.state_root().clone();
let parent_storage_root = *parent_header.state_root();
let inclusion::ProcessedCandidates::<<T::Header as HeaderT>::Hash> {
core_indices: occupied,
candidate_receipt_with_backing_validator_indices,
@@ -711,7 +711,7 @@ impl<T: Config> Pallet<T> {
let scheduled = <scheduler::Pallet<T>>::scheduled();
let relay_parent_number = now - One::one();
let parent_storage_root = parent_header.state_root().clone();
let parent_storage_root = *parent_header.state_root();
let check_ctx = CandidateCheckContext::<T>::new(now, relay_parent_number);
let backed_candidates = sanitize_backed_candidates::<T, _>(
@@ -1201,7 +1201,7 @@ fn compute_entropy<T: Config>(parent_hash: T::Hash) -> [u8; 32] {
// known 2 epochs ago. it is marginally better than using the parent block
// hash since it's harder to influence the VRF output than the block hash.
let vrf_random = ParentBlockRandomness::<T>::random(&CANDIDATE_SEED_SUBJECT[..]).0;
let mut entropy: [u8; 32] = CANDIDATE_SEED_SUBJECT.clone();
let mut entropy: [u8; 32] = CANDIDATE_SEED_SUBJECT;
if let Some(vrf_random) = vrf_random {
entropy.as_mut().copy_from_slice(vrf_random.as_ref());
} else {
@@ -107,7 +107,7 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T:
<inclusion::Pallet<T>>::pending_availability(para_id)
.expect("Occupied core always has pending availability; qed");
let backed_in_number = pending_availability.backed_in_number().clone();
let backed_in_number = *pending_availability.backed_in_number();
OccupiedCore {
next_up_on_available: <scheduler::Pallet<T>>::next_up_on_available(
CoreIndex(i as u32),
@@ -135,7 +135,7 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T:
<inclusion::Pallet<T>>::pending_availability(para_id)
.expect("Occupied core always has pending availability; qed");
let backed_in_number = pending_availability.backed_in_number().clone();
let backed_in_number = *pending_availability.backed_in_number();
OccupiedCore {
next_up_on_available: <scheduler::Pallet<T>>::next_up_on_available(
CoreIndex(i as u32),
+5 -7
View File
@@ -483,7 +483,7 @@ impl<T: Config> Pallet<T> {
Some(CoreAssignment {
kind: AssignmentKind::Parachain,
para_id: parachains[core_index],
core: core.clone(),
core,
group_idx: Self::group_assigned_to_core(core, now).expect(
"core is not out of bounds and we are guaranteed \
to be after the most recent session start; qed",
@@ -496,7 +496,7 @@ impl<T: Config> Pallet<T> {
parathread_queue.take_next_on_core(core_offset).map(|entry| CoreAssignment {
kind: AssignmentKind::Parathread(entry.claim.1, entry.retries),
para_id: entry.claim.0,
core: core.clone(),
core,
group_idx: Self::group_assigned_to_core(core, now).expect(
"core is not out of bounds and we are guaranteed \
to be after the most recent session start; qed",
@@ -610,11 +610,9 @@ impl<T: Config> Pallet<T> {
(at - session_start_block) / config.group_rotation_frequency.into();
let rotations_since_session_start =
match <T::BlockNumber as TryInto<u32>>::try_into(rotations_since_session_start) {
Ok(i) => i,
Err(_) => 0, // can only happen if rotations occur only once every u32::max(),
// so functionally no difference in behavior.
};
<T::BlockNumber as TryInto<u32>>::try_into(rotations_since_session_start).unwrap_or(0);
// Error case can only happen if rotations occur only once every u32::max(),
// so functionally no difference in behavior.
let group_idx =
(core.0 as usize + rotations_since_session_start as usize) % validator_groups.len();
+1 -1
View File
@@ -107,7 +107,7 @@ impl<XcmExecutor: xcm::latest::ExecuteXcm<C::RuntimeCall>, C: Config> UmpSink
VersionedXcm,
};
let id = upward_message_id(&data[..]);
let id = upward_message_id(data);
let maybe_msg_and_weight = VersionedXcm::<C::RuntimeCall>::decode_all_with_depth_limit(
xcm::MAX_XCM_DECODE_DEPTH,
&mut data,