Skip to content

Commit b73669e

Browse files
committed
cargo clippy
1 parent cdfc323 commit b73669e

File tree

12 files changed

+28
-60
lines changed

12 files changed

+28
-60
lines changed

iapyx/src/backend/mod.rs

+2-31
Original file line numberDiff line numberDiff line change
@@ -127,43 +127,14 @@ impl WalletBackend {
127127
&self,
128128
_identifier: AccountIdentifier,
129129
) -> Result<Vec<SimpleVoteStatus>, WalletBackendError> {
130-
/*
131-
let vote_plan_statuses = self.vote_plan_statuses().unwrap();
132-
let proposals = self.proposals().unwrap();
133-
134-
135-
let mut active_votes = Vec::new();
136-
for vote_plan_status in vote_plan_statuses {
137-
for proposal in vote_plan_status.proposals {
138-
for (account, payload) in proposal.votes.iter() {
139-
if *account == identifier {
140-
let vit_proposal = proposals
141-
.iter()
142-
.find(|x| {
143-
x.chain_proposal_id_as_str()
144-
== proposal.proposal_id.clone().to_string()
145-
})
146-
.unwrap();
147-
active_votes.push(SimpleVoteStatus {
148-
chain_proposal_id: vit_proposal.chain_proposal_id_as_str(),
149-
proposal_title: vit_proposal.proposal_title.clone(),
150-
choice: vit_proposal.get_option_text(payload.choice().unwrap().clone()),
151-
});
152-
}
153-
}
154-
}
155-
}
156-
Ok(active_votes)
157-
*/
158130
unimplemented!()
159131
}
160132

161133
pub fn settings(&self) -> Result<Settings, WalletBackendError> {
162134
let block0 = self.block0()?;
163135
let mut block0_bytes = ReadBuf::from(&block0);
164136
let block0 = Block::read(&mut block0_bytes).map_err(WalletBackendError::Block0ReadError)?;
165-
Ok(Settings::new(&block0)
166-
.map_err(|e| WalletBackendError::SettingsReadError(Box::new(e)))?)
137+
Settings::new(&block0).map_err(|e| WalletBackendError::SettingsReadError(Box::new(e)))
167138
}
168139

169140
pub fn account_exists(&self, id: AccountId) -> Result<bool, WalletBackendError> {
@@ -180,7 +151,7 @@ pub enum WalletBackendError {
180151
#[error("node rest error")]
181152
ProxyConnectionError(#[from] ProxyClientError),
182153
#[error("io error")]
183-
IOError(#[from] std::io::Error),
154+
IoError(#[from] std::io::Error),
184155
#[error("block0 retrieve error")]
185156
Block0ReadError(#[from] chain_core::mempack::ReadError),
186157
#[error("block0 retrieve error")]

iapyx/src/cli/args/interactive/command.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ pub enum Recover {
311311
/// recover wallet funds from mnemonic
312312
Mnemonics(RecoverFromMnemonics),
313313
/// recover wallet funds from qr code
314-
QR(RecoverFromQR),
314+
Qr(RecoverFromQr),
315315
/// recover wallet funds from private key
316316
Secret(RecoverFromSecretKey),
317317
}
@@ -320,7 +320,7 @@ impl Recover {
320320
pub fn exec(&self, model: &mut UserInteractionContoller) -> Result<(), IapyxCommandError> {
321321
match self {
322322
Recover::Mnemonics(mnemonics) => mnemonics.exec(model),
323-
Recover::QR(qr) => qr.exec(model),
323+
Recover::Qr(qr) => qr.exec(model),
324324
Recover::Secret(sk) => sk.exec(model),
325325
}
326326
}
@@ -345,15 +345,15 @@ impl RecoverFromSecretKey {
345345
}
346346

347347
#[derive(StructOpt, Debug)]
348-
pub struct RecoverFromQR {
348+
pub struct RecoverFromQr {
349349
#[structopt(short = "q", long = "qr")]
350350
pub qr_code: PathBuf,
351351

352352
#[structopt(short = "p", long = "password")]
353353
pub password: String,
354354
}
355355

356-
impl RecoverFromQR {
356+
impl RecoverFromQr {
357357
pub fn exec(&self, model: &mut UserInteractionContoller) -> Result<(), IapyxCommandError> {
358358
model.controller = Some(Controller::recover_from_qr(
359359
model.backend_address.clone(),

iapyx/src/cli/args/qr/address.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::path::PathBuf;
1818
use structopt::StructOpt;
1919
use url::Url;
2020
#[derive(StructOpt, Debug)]
21-
pub struct GetAddressFromQRCommand {
21+
pub struct GetAddressFromQrCommand {
2222
#[structopt(long = "qr")]
2323
pub qr: PathBuf,
2424

@@ -40,7 +40,7 @@ pub struct GetAddressFromQRCommand {
4040
pub block0: Option<String>,
4141
}
4242

43-
impl GetAddressFromQRCommand {
43+
impl GetAddressFromQrCommand {
4444
pub fn exec(&self) -> Result<(), IapyxQrCommandError> {
4545
println!("Decoding qr from file: {:?}...", self.qr);
4646
let pin_read_mode = PinReadMode::new(self.read_pin_from_filename, &self.pin);

iapyx/src/cli/args/qr/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mod address;
22
mod secret;
33
mod verify;
4-
use crate::cli::args::qr::secret::GetSecretFromQRCommand;
5-
use address::GetAddressFromQRCommand;
4+
use crate::cli::args::qr::secret::GetSecretFromQrCommand;
5+
use address::GetAddressFromQrCommand;
66
use jormungandr_lib::interfaces::Block0ConfigurationError;
77
use structopt::StructOpt;
88
use thiserror::Error;
@@ -11,8 +11,8 @@ use verify::VerifyQrCommand;
1111
#[derive(StructOpt, Debug)]
1212
pub enum IapyxQrCommand {
1313
Verify(VerifyQrCommand),
14-
CheckAddress(GetAddressFromQRCommand),
15-
Secret(GetSecretFromQRCommand),
14+
CheckAddress(GetAddressFromQrCommand),
15+
Secret(GetSecretFromQrCommand),
1616
}
1717

1818
impl IapyxQrCommand {

iapyx/src/cli/args/qr/secret.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::PathBuf;
1111
use structopt::StructOpt;
1212

1313
#[derive(StructOpt, Debug)]
14-
pub struct GetSecretFromQRCommand {
14+
pub struct GetSecretFromQrCommand {
1515
#[structopt(long = "qr")]
1616
pub qr: PathBuf,
1717

@@ -22,7 +22,7 @@ pub struct GetSecretFromQRCommand {
2222
pub read_pin_from_filename: bool,
2323
}
2424

25-
impl GetSecretFromQRCommand {
25+
impl GetSecretFromQrCommand {
2626
pub fn exec(&self) -> Result<(), IapyxQrCommandError> {
2727
println!("Decoding qr from file: {:?}...", self.qr);
2828
let pin_read_mode = PinReadMode::new(self.read_pin_from_filename, &self.pin);

iapyx/src/data.rs

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ impl Proposal {
157157
}
158158
}
159159

160+
#[allow(clippy::from_over_into)]
160161
impl Into<wallet_core::Proposal> for Proposal {
161162
fn into(self) -> wallet_core::Proposal {
162163
let chain_proposal_index = self.chain_proposal_index as u8;

iapyx/src/qr/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ pub enum PinReadError {
3030
#[error("cannot split file name from path {0:?}")]
3131
UnableToSplitFileName(PathBuf),
3232
#[error("Cannot read qr from file")]
33-
UnableToReadQR(#[from] std::io::Error),
33+
UnableToReadQr(#[from] std::io::Error),
3434
#[error("Cannot decode qr from file")]
35-
UnableToDecodeQR(#[from] KeyQrCodeError),
35+
UnableToDecodeQr(#[from] KeyQrCodeError),
3636
#[error("cannot open image")]
3737
UnableToOpenImage(#[from] image::ImageError),
3838
}

iapyx/src/utils/serde.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ pub fn deserialize_unix_timestamp_from_rfc3339<'de, D>(deserializer: D) -> Resul
1919
where
2020
D: Deserializer<'de>,
2121
{
22-
struct RFC3339Deserializer();
22+
struct Rfc3339Deserializer();
2323

24-
impl<'de> Visitor<'de> for RFC3339Deserializer {
24+
impl<'de> Visitor<'de> for Rfc3339Deserializer {
2525
type Value = DateTime<Utc>;
2626

2727
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@@ -40,7 +40,7 @@ where
4040
}
4141

4242
deserializer
43-
.deserialize_str(RFC3339Deserializer())
43+
.deserialize_str(Rfc3339Deserializer())
4444
.map(|datetime| datetime.timestamp())
4545
}
4646

integration-tests/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum Error {
2727

2828
#[allow(dead_code)]
2929
pub enum Vote {
30-
BLANK = 0,
31-
YES = 1,
32-
NO = 2,
30+
Blank = 0,
31+
Yes = 1,
32+
No = 2,
3333
}

snapshot-trigger-service/src/client/rest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,5 @@ pub enum Error {
125125
#[error("yaml response serialization error")]
126126
SerdeYamlError(#[from] serde_yaml::Error),
127127
#[error("io error")]
128-
IOError(#[from] std::io::Error),
128+
IoError(#[from] std::io::Error),
129129
}

vitup/src/mock/mock_state.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct MockState {
2121
vit_state: Snapshot,
2222
}
2323

24-
pub fn context(testing_directory: &PathBuf) -> Context {
24+
pub fn context<P: AsRef<Path>>(testing_directory: P) -> Context {
2525
let jormungandr = prepare_command(PathBuf::from_str("jormungandr").unwrap());
2626
let jcli = prepare_command(PathBuf::from_str("jcli").unwrap());
2727
let seed = Seed::generate(rand::rngs::OsRng);
@@ -32,7 +32,7 @@ pub fn context(testing_directory: &PathBuf) -> Context {
3232
seed,
3333
jormungandr,
3434
jcli,
35-
Some(testing_directory.clone()),
35+
Some(testing_directory.as_ref().to_path_buf()),
3636
generate_documentation,
3737
ProgressBarMode::None,
3838
log_level,

vitup/src/scenario/vit_station/data.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use assert_fs::TempDir;
2-
use std::path::PathBuf;
2+
use std::path::Path;
33
use vit_servicing_station_tests::common::data::ValidVotePlanParameters;
44
use vit_servicing_station_tests::common::data::{
55
ValidVotePlanGenerator, ValidVotingTemplateGenerator,
@@ -14,11 +14,7 @@ impl DbGenerator {
1414
Self { parameters }
1515
}
1616

17-
pub fn build(
18-
self,
19-
db_file: &PathBuf,
20-
template_generator: &mut dyn ValidVotingTemplateGenerator,
21-
) {
17+
pub fn build(self, db_file: &Path, template_generator: &mut dyn ValidVotingTemplateGenerator) {
2218
std::fs::File::create(&db_file).unwrap();
2319

2420
let mut generator = ValidVotePlanGenerator::new(self.parameters);

0 commit comments

Comments
 (0)