-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What? Run clippy::all, which contains the default lint groups (correctness, suspicious, style, complexity, perf) ## Why? We haven't checked clippy in a long time, it provides useful feedback on code style ## How? We define in the workspace the clippy lints we want to run, and the ones we want to ignore In certain pallets like democracy, which are forks, we don't want to check the clippy there, so we ignore everything. ## Anything else? I started trying to do both all and pedantic groups, but pedantic is huge and would have made the PR bloated. I implemented some of those changes like the module name repetition, but then stopped. I will in a later PR cherry pick some lints from pedantic and add them to the workspace
- Loading branch information
Showing
81 changed files
with
617 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,21 @@ members = [ | |
default-members = ["nodes/*", "pallets/*"] | ||
resolver = "2" | ||
|
||
[workspace.lints.clippy] | ||
all = { level = "warn", priority = -1} | ||
#all = { level = "allow", priority = -1} | ||
#pedantic = { level = "warn", priority = -1} | ||
#pedantic = { level = "allow", priority = -1} | ||
|
||
inconsistent_digit_grouping = "allow" | ||
zero_prefixed_literal = "allow" | ||
missing_errors_doc = "allow" | ||
must_use_candidate = "allow" | ||
identity_op = "allow" | ||
|
||
[workspace.lints.rust] | ||
unreachable_patterns = "deny" | ||
|
||
[workspace.package] | ||
authors = ['Polimec Foundation <[email protected]>'] | ||
documentation = "https://wiki.polimec.org/" | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
// If you feel like getting in touch with us, you can do so at [email protected] | ||
|
||
use crate::*; | ||
use crate::{Call, Config}; | ||
use frame_support::{ | ||
dispatch::{CheckIfFeeless, DispatchInfo}, | ||
pallet_prelude::*, | ||
|
@@ -120,13 +120,7 @@ where | |
let provides = vec![Encode::encode(&(who, self.0))]; | ||
let requires = if account.nonce < self.0 { vec![Encode::encode(&(who, self.0 - One::one()))] } else { vec![] }; | ||
|
||
Ok(ValidTransaction { | ||
priority: 0, | ||
requires, | ||
provides, | ||
longevity: TransactionLongevity::max_value(), | ||
propagate: true, | ||
}) | ||
Ok(ValidTransaction { priority: 0, requires, provides, longevity: TransactionLongevity::MAX, propagate: true }) | ||
} | ||
} | ||
|
||
|
@@ -219,10 +213,8 @@ where | |
len: usize, | ||
result: &DispatchResult, | ||
) -> Result<(), TransactionValidityError> { | ||
if let Some(pre) = pre { | ||
if let Some(pre) = pre { | ||
S::post_dispatch(Some(pre), info, post_info, len, result)?; | ||
} | ||
if let Some(Some(pre)) = pre { | ||
S::post_dispatch(Some(pre), info, post_info, len, result)?; | ||
} | ||
Ok(()) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,10 @@ | |
// If you feel like getting in touch with us, you can do so at [email protected] | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
// Needed due to empty sections raising the warning | ||
#![allow(unreachable_patterns)] | ||
#![allow(clippy::large_enum_variant)] | ||
|
||
pub use pallet::*; | ||
|
||
pub use crate::weights::WeightInfo; | ||
|
@@ -45,6 +49,7 @@ pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId; | |
type CurrencyOf<T> = <<T as Config>::VestingSchedule as VestingSchedule<AccountIdOf<T>>>::Currency; | ||
#[frame_support::pallet] | ||
pub mod pallet { | ||
#[allow(clippy::wildcard_imports)] | ||
use super::*; | ||
use crate::weights::WeightInfo; | ||
use frame_support::{ | ||
|
@@ -145,9 +150,9 @@ pub mod pallet { | |
impl<T: Config> Pallet<T> { | ||
#[pallet::feeless_if( | origin: &OriginFor<T>, jwt: &UntrustedToken | -> bool { | ||
if let Ok((_, did, _, _)) = T::InvestorOrigin::ensure_origin(origin.clone(), jwt, T::VerifierPublicKey::get()) { | ||
return Dispensed::<T>::get(did).is_none() | ||
Dispensed::<T>::get(did).is_none() | ||
} else { | ||
return false | ||
false | ||
} | ||
})] | ||
#[pallet::call_index(0)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#[allow(clippy::wildcard_imports)] | ||
use super::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
|
Oops, something went wrong.