Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrxlz committed Jan 7, 2025
1 parent 200b2cc commit 4f71949
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 0 additions & 3 deletions packages/kos/src/chains/bch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct BCH {}

impl BCH {
#[allow(clippy::needless_range_loop)]

fn expand_prefix(prefix: &str) -> Result<Vec<u8>, ChainError> {
let mut prefix_bytes = prefix.as_bytes().to_vec();
for i in 0..prefix_bytes.len() {
Expand All @@ -28,7 +27,6 @@ impl BCH {
}

#[allow(clippy::needless_range_loop)]

fn create_checksum(prefix: &str, payload: &[u8]) -> Result<Vec<u8>, ChainError> {
let expanded_prefix = BCH::expand_prefix(prefix)?;
let to_encode = [expanded_prefix, payload.to_vec(), vec![0u8; 8]].concat();
Expand Down Expand Up @@ -114,7 +112,6 @@ impl Chain for BCH {
}

#[allow(clippy::needless_range_loop)]

fn get_address(&self, public_key: Vec<u8>) -> Result<String, ChainError> {
if public_key.len() != 33 {
return Err(ChainError::InvalidPublicKey);
Expand Down
3 changes: 0 additions & 3 deletions packages/kos/src/chains/klv/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ impl TryFrom<chains::klv::models::Raw> for proto::transaction::Raw {
type Error = ConversionError;

#[allow(clippy::needless_update)]

fn try_from(value: chains::klv::models::Raw) -> Result<Self, Self::Error> {
let contracts = value
.contract
Expand Down Expand Up @@ -197,7 +196,6 @@ impl TryFrom<chains::klv::models::Parameter> for protos::Any {
type Error = ConversionError;

#[allow(clippy::needless_update)]

fn try_from(value: chains::klv::models::Parameter) -> Result<Self, Self::Error> {
let proto_parameter = protos::Any {
type_url: value.type_url,
Expand All @@ -213,7 +211,6 @@ impl TryFrom<chains::klv::models::KdaFee> for proto::transaction::KdaFee {
type Error = ConversionError;

#[allow(clippy::needless_update)]

fn try_from(value: chains::klv::models::KdaFee) -> Result<Self, Self::Error> {
let kda_bytes =
simple_base64_decode(&value.kda).map_err(|_| ConversionError::Base64Error)?;
Expand Down
12 changes: 6 additions & 6 deletions packages/kos/src/chains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ impl ChainRegistry {
}

fn get_chain_by_base_id(&self, base_id: u32) -> Option<Box<dyn Chain>> {
for &(_, ref chain_info) in self.registry {
for (_, chain_info) in self.registry {
let chain = (chain_info.factory)();
if chain.get_id() == base_id {
return Some(chain);
Expand All @@ -653,15 +653,15 @@ impl ChainRegistry {

fn get_chains(&self) -> Vec<u32> {
let mut ids = Vec::new();
for &(_, ref chain_info) in self.registry {
for (_, chain_info) in self.registry {
let chain = (chain_info.factory)();
ids.push(chain.get_id());
}
ids
}

fn is_chain_supported(&self, id: u32) -> bool {
for &(_, ref chain_info) in self.registry {
for (_, chain_info) in self.registry {
let chain = (chain_info.factory)();
if chain.get_id() == id {
return chain_info.supported;
Expand All @@ -672,7 +672,7 @@ impl ChainRegistry {

fn get_supported_chains(&self) -> Vec<u32> {
let mut ids = Vec::new();
for &(_, ref chain_info) in self.registry {
for (_, chain_info) in self.registry {
let chain = (chain_info.factory)();
if chain_info.supported {
ids.push(chain.get_id());
Expand All @@ -694,7 +694,7 @@ pub enum CustomChainType {
}

pub fn get_chain_by_params(params: CustomChainType) -> Option<Box<dyn Chain>> {
return match params {
match params {
CustomChainType::NotCustom(c) => get_chain_by_id(c),
CustomChainType::CustomEth(chaincode) => Some(Box::new(eth::ETH::new_eth_based(
0,
Expand All @@ -704,7 +704,7 @@ pub fn get_chain_by_params(params: CustomChainType) -> Option<Box<dyn Chain>> {
))),
CustomChainType::CustomSubstrate(_) => None,
CustomChainType::CustomCosmos(_) => None,
};
}
}

pub fn get_chain_by_base_id(base_id: u32) -> Option<Box<dyn Chain>> {
Expand Down
1 change: 0 additions & 1 deletion packages/kos/src/crypto/bignum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ impl U256 {
}

#[allow(clippy::needless_range_loop)]

pub fn to_f64(&self, precision: u32) -> f64 {
let bytes = self.0;
let mut value: f64 = 0.0;
Expand Down

0 comments on commit 4f71949

Please sign in to comment.