Skip to content

Commit

Permalink
clippy automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-soshte committed Jan 9, 2024
1 parent 124410d commit 7ff00e5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/claimant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl ClaimantBehavior for Claimant {
let key = PublicKey::from_string(destination.unwrap());

if key.is_err() {
return Err("accountId is invalid".into());
return Err("accountId is invalid");
}

let actual_predicate = match predicate {
Expand Down Expand Up @@ -105,7 +105,7 @@ impl ClaimantBehavior for Claimant {

fn to_xdr_object(&self) -> stellar_xdr::next::Claimant {
let claimant = stellar_xdr::next::ClaimantV0 {
destination: Keypair::from_public_key(&self.destination.clone().unwrap().as_str())
destination: Keypair::from_public_key(self.destination.clone().unwrap().as_str())
.unwrap()
.xdr_account_id(),
predicate: self.predicate.clone(),
Expand All @@ -115,8 +115,8 @@ impl ClaimantBehavior for Claimant {
}

fn destination(&self) -> Option<String> {
let val = self.destination.clone();
val

self.destination.clone()
}

fn set_destination(&mut self, _value: String) {
Expand Down
4 changes: 1 addition & 3 deletions src/get_liquidity_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ impl LiquidityPoolBehavior for LiquidityPool {
"liquidityPoolType is invalid",
)));
}
let liquidity_pool_parametes_x = match liquidity_pool_parameters.clone() {
LiquidityPoolParameters::LiquidityPoolConstantProduct(x) => x,
};
let LiquidityPoolParameters::LiquidityPoolConstantProduct(liquidity_pool_parametes_x) = liquidity_pool_parameters.clone();

if liquidity_pool_parametes_x.fee != LIQUIDITY_POOL_FEE_V18 {
return Err(Box::new(std::io::Error::new(
Expand Down
8 changes: 2 additions & 6 deletions src/liquidity_pool_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,15 @@ impl LiquidityPoolAssetBehavior for LiquidityPoolAsset {
fn from_operation(ct_asset_xdr: &ChangeTrustAsset) -> Result<LiquidityPoolAsset, String> {
match ct_asset_xdr {
ChangeTrustAsset::PoolShare(x) => {
let val = match x {
stellar_xdr::next::LiquidityPoolParameters::LiquidityPoolConstantProduct(x) => {
x
}
};
let stellar_xdr::next::LiquidityPoolParameters::LiquidityPoolConstantProduct(val) = x;

let asset_a = Asset::from_operation(val.asset_a.clone()).unwrap();
let asset_b = Asset::from_operation(val.asset_b.clone()).unwrap();
let fee = val.fee;
Ok(LiquidityPoolAsset::new(asset_a, asset_b, fee)?)
}

_ => Err(format!("Invalid asset type")),
_ => Err("Invalid asset type".to_string()),
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,7 @@ fn from_xdr_price(price: stellar_xdr::next::Price) -> String {
}

fn account_id_to_address(account_id: &AccountId) -> String {
let val = match account_id.0.clone() {
stellar_xdr::next::PublicKey::PublicKeyTypeEd25519(x) => x,
};
let stellar_xdr::next::PublicKey::PublicKeyTypeEd25519(val) = account_id.0.clone();
let key: Result<PublicKey, stellar_strkey::DecodeError> =
PublicKey::from_string(val.to_string().as_str());

Expand Down

0 comments on commit 7ff00e5

Please sign in to comment.