Skip to content

Commit

Permalink
Fix clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
koxu1996 committed Feb 6, 2024
1 parent 9abe4f0 commit e376530
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
6 changes: 3 additions & 3 deletions kairos-cli/bin/commands/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ impl ClientCommand for Deposit {
const NAME: &'static str = "deposit";
const ABOUT: &'static str = "Deposits funds into your account";

fn new() -> Command {
fn new_cmd() -> Command {
Command::new(Self::NAME)
.about(Self::ABOUT)
.arg(amount::arg())
.arg(private_key::arg())
}

fn run(matches: &ArgMatches) -> Result<Output, CliError> {
let amount = amount::get(matches)?;
let _amount = amount::get(matches)?;
let private_key = private_key::get(matches)?;

let signer = CasperSigner::from_key(private_key);
let _signer = CasperSigner::from_key(private_key);

// TODO: Create transaction and sign it with `signer`.

Expand Down
2 changes: 1 addition & 1 deletion kairos-cli/bin/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub trait ClientCommand {
const ABOUT: &'static str;

/// Constructs the clap subcommand.
fn new() -> Command;
fn new_cmd() -> Command;

/// Parses the arg matches and runs the subcommand.
fn run(matches: &ArgMatches) -> Result<Output, CliError>;
Expand Down
8 changes: 4 additions & 4 deletions kairos-cli/bin/commands/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl ClientCommand for Transfer {
const NAME: &'static str = "transfer";
const ABOUT: &'static str = "Transfers funds to another account";

fn new() -> Command {
fn new_cmd() -> Command {
Command::new(Self::NAME)
.about(Self::ABOUT)
.arg(recipient::arg())
Expand All @@ -45,11 +45,11 @@ impl ClientCommand for Transfer {
}

fn run(matches: &ArgMatches) -> Result<Output, CliError> {
let recipient = recipient::get(matches)?;
let amount = amount::get(matches)?;
let _recipient = recipient::get(matches)?;
let _amount = amount::get(matches)?;
let private_key = private_key::get(matches)?;

let signer = CasperSigner::from_key(private_key);
let _signer = CasperSigner::from_key(private_key);

// TODO: Create transaction and sign it with `signer`.

Expand Down
6 changes: 3 additions & 3 deletions kairos-cli/bin/commands/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ impl ClientCommand for Withdraw {
const NAME: &'static str = "withdraw";
const ABOUT: &'static str = "Withdraws funds from your account";

fn new() -> Command {
fn new_cmd() -> Command {
Command::new(Self::NAME)
.about(Self::ABOUT)
.arg(amount::arg())
.arg(private_key::arg())
}

fn run(matches: &ArgMatches) -> Result<Output, CliError> {
let amount = amount::get(matches)?;
let _amount = amount::get(matches)?;
let private_key = private_key::get(matches)?;

let signer = CasperSigner::from_key(private_key);
let _signer = CasperSigner::from_key(private_key);

// TODO: Create transaction and sign it with `signer`.

Expand Down
4 changes: 2 additions & 2 deletions kairos-cli/bin/common/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub mod amount {
let value = matches
.get_one::<String>(ARG_NAME)
.map(String::as_str)
.ok_or_else(|| CliError::MissingArgument { context: ARG_NAME })?;
.ok_or(CliError::MissingArgument { context: ARG_NAME })?;

let amount = value
.parse::<u64>()
Expand Down Expand Up @@ -51,7 +51,7 @@ pub mod private_key {
let value = matches
.get_one::<String>(ARG_NAME)
.map(String::as_str)
.ok_or_else(|| CliError::MissingArgument { context: ARG_NAME })?;
.ok_or(CliError::MissingArgument { context: ARG_NAME })?;

let private_key =
CasperPrivateKey::from_file(value).map_err(|error| CliError::CryptoError { error })?;
Expand Down
3 changes: 1 addition & 2 deletions kairos-cli/bin/crypto/private_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ impl CasperPrivateKey {
pub fn from_file(file_path: &str) -> Result<Self, CryptoError> {
let secret_key = casper_types::SecretKey::from_file(file_path)
.map_err(|_e| CryptoError::FailedToParseKey {})?;
let private_key = casper_types::SecretKey::from(secret_key);
Ok(Self(private_key))
Ok(Self(secret_key))
}
}
1 change: 1 addition & 0 deletions kairos-cli/bin/crypto/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl CasperPublicKey {
Self(public_key)
}

#[allow(unused)]
fn get(&self) -> Result<Vec<u8>, CryptoError> {
self.0
.to_bytes()
Expand Down
2 changes: 2 additions & 0 deletions kairos-cli/bin/crypto/signer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused)]

use super::private_key::CasperPrivateKey;
use super::public_key::CasperPublicKey;
use crate::crypto::error::CryptoError;
Expand Down
6 changes: 3 additions & 3 deletions kairos-cli/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::process;
fn cli() -> Command {
Command::new("Kairos Client")
.about("CLI for interacting with Kairos")
.subcommand(Deposit::new())
.subcommand(Transfer::new())
.subcommand(Withdraw::new())
.subcommand(Deposit::new_cmd())
.subcommand(Transfer::new_cmd())
.subcommand(Withdraw::new_cmd())
}

fn main() {
Expand Down

0 comments on commit e376530

Please sign in to comment.