mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
add clippy to CI (#9694)
* Focus on correctness lints. This relies on a compiler patch that landed 8th July 2021. If people are using an earlier version of the compiler everything will still work unless they try and run clippy. Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
This commit is contained in:
@@ -78,7 +78,7 @@ pub trait GetCallMetadata {
|
||||
}
|
||||
|
||||
/// The version of a crate.
|
||||
#[derive(RuntimeDebug, Eq, PartialEq, Encode, Decode, Ord, Clone, Copy, Default)]
|
||||
#[derive(RuntimeDebug, Eq, PartialEq, Encode, Decode, Clone, Copy, Default)]
|
||||
pub struct CrateVersion {
|
||||
/// The major version of the crate.
|
||||
pub major: u16,
|
||||
@@ -94,14 +94,17 @@ impl CrateVersion {
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::cmp::Ord for CrateVersion {
|
||||
fn cmp(&self, other: &Self) -> sp_std::cmp::Ordering {
|
||||
self.major
|
||||
.cmp(&other.major)
|
||||
.then_with(|| self.minor.cmp(&other.minor).then_with(|| self.patch.cmp(&other.patch)))
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::cmp::PartialOrd for CrateVersion {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<sp_std::cmp::Ordering> {
|
||||
let res = self
|
||||
.major
|
||||
.cmp(&other.major)
|
||||
.then_with(|| self.minor.cmp(&other.minor).then_with(|| self.patch.cmp(&other.patch)));
|
||||
|
||||
Some(res)
|
||||
Some(<Self as Ord>::cmp(&self, other))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user