mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Relaxed clippy fixes/nits (#2661)
This PR contains just a few clippy fixes and nits, which are, however, relaxed by workspace clippy settings here: https://github.com/paritytech/polkadot-sdk/blob/master/Cargo.toml#L483-L506 --------- Co-authored-by: Dmitry Sinyavin <dmitry.sinyavin@parity.io> Co-authored-by: ordian <write@reusable.software> Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -101,7 +101,9 @@ pub trait Database<H: Clone + AsRef<[u8]>>: Send + Sync {
|
||||
/// This may be faster than `get` since it doesn't allocate.
|
||||
/// Use `with_get` helper function if you need `f` to return a value from `f`
|
||||
fn with_get(&self, col: ColumnId, key: &[u8], f: &mut dyn FnMut(&[u8])) {
|
||||
self.get(col, key).map(|v| f(&v));
|
||||
if let Some(v) = self.get(col, key) {
|
||||
f(&v)
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if database supports internal ref counting for state data.
|
||||
|
||||
@@ -89,7 +89,7 @@ struct RuntimeInterfaceFunctionSet {
|
||||
impl RuntimeInterfaceFunctionSet {
|
||||
fn new(version: VersionAttribute, trait_item: &TraitItemFn) -> Result<Self> {
|
||||
Ok(Self {
|
||||
latest_version_to_call: version.is_callable().then(|| version.version),
|
||||
latest_version_to_call: version.is_callable().then_some(version.version),
|
||||
versions: BTreeMap::from([(
|
||||
version.version,
|
||||
RuntimeInterfaceFunction::new(trait_item)?,
|
||||
|
||||
@@ -414,12 +414,13 @@ impl ChildTrieParentKeyId {
|
||||
///
|
||||
/// V0 and V1 uses a same trie implementation, but V1 will write external value node in the trie for
|
||||
/// value with size at least `TRIE_VALUE_NODE_THRESHOLD`.
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "std", derive(Encode, Decode))]
|
||||
pub enum StateVersion {
|
||||
/// Old state version, no value nodes.
|
||||
V0 = 0,
|
||||
/// New state version can use value nodes.
|
||||
#[default]
|
||||
V1 = 1,
|
||||
}
|
||||
|
||||
@@ -432,12 +433,6 @@ impl Display for StateVersion {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for StateVersion {
|
||||
fn default() -> Self {
|
||||
StateVersion::V1
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StateVersion> for u8 {
|
||||
fn from(version: StateVersion) -> u8 {
|
||||
version as u8
|
||||
|
||||
Reference in New Issue
Block a user