Skip to content

Commit 9d65302

Browse files
committed
chore: resolve clippy warnings
1 parent b63b72e commit 9d65302

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

src/arguments/list.rs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ impl<'a> TryFrom<&'a OTPElement> for JsonOtpList<'a> {
5858

5959
impl SubcommandExecutor for ListArgs {
6060
fn run_command(self, otp_database: OTPDatabase) -> color_eyre::Result<OTPDatabase> {
61-
let elements_iterator = otp_database.elements.iter().enumerate();
62-
6361
if self.format.unwrap_or_default().json {
64-
let json_elements = elements_iterator
65-
.map(|(_, element)| element.try_into())
62+
let json_elements = otp_database
63+
.elements
64+
.iter()
65+
.map(|element| element.try_into())
6666
.collect::<Result<Vec<JsonOtpList>>>()?;
6767

6868
let stringified = serde_json::to_string_pretty(&json_elements)
@@ -73,19 +73,23 @@ impl SubcommandExecutor for ListArgs {
7373
"{0: <6} {1: <30} {2: <70} {3: <10}",
7474
"Index", "Issuer", "Label", "OTP"
7575
);
76-
elements_iterator.for_each(|(index, e)| {
77-
println!(
78-
"{0: <6} {1: <30} {2: <70} {3: <10}",
79-
index,
80-
if e.issuer.is_empty() {
81-
"<No issuer>"
82-
} else {
83-
e.issuer.as_str()
84-
},
85-
&e.label,
86-
e.get_otp_code().unwrap_or("ERROR".to_string())
87-
)
88-
});
76+
otp_database
77+
.elements
78+
.iter()
79+
.enumerate()
80+
.for_each(|(index, e)| {
81+
println!(
82+
"{0: <6} {1: <30} {2: <70} {3: <10}",
83+
index,
84+
if e.issuer.is_empty() {
85+
"<No issuer>"
86+
} else {
87+
e.issuer.as_str()
88+
},
89+
&e.label,
90+
e.get_otp_code().unwrap_or("ERROR".to_string())
91+
)
92+
});
8993
}
9094

9195
Ok(otp_database)

src/interface/event.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::mpsc;
22
use std::thread;
33
use std::time::{Duration, Instant};
44

5-
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent};
5+
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind};
66

77
use crate::interface::app::AppResult;
88

@@ -14,15 +14,15 @@ pub enum Event {
1414
/// Key press.
1515
Key(KeyEvent),
1616
/// Mouse click/scroll.
17-
Mouse(MouseEvent),
17+
Mouse(()),
1818
/// Terminal resize.
19-
Resize(u16, u16),
19+
Resize((), ()),
2020
/// Focus gained
2121
FocusGained(),
2222
/// Focus lost
2323
FocusLost(),
2424
/// Paste text
25-
Paste(String),
25+
Paste(()),
2626
}
2727

2828
/// Terminal event handler.
@@ -59,11 +59,11 @@ impl EventHandler {
5959
Ok(())
6060
}
6161
}
62-
CrosstermEvent::Mouse(e) => sender.send(Event::Mouse(e)),
63-
CrosstermEvent::Resize(w, h) => sender.send(Event::Resize(w, h)),
62+
CrosstermEvent::Mouse(_e) => sender.send(Event::Mouse(())),
63+
CrosstermEvent::Resize(_w, _h) => sender.send(Event::Resize((), ())),
6464
CrosstermEvent::FocusGained => sender.send(Event::FocusGained()),
6565
CrosstermEvent::FocusLost => sender.send(Event::FocusLost()),
66-
CrosstermEvent::Paste(e) => sender.send(Event::Paste(e)),
66+
CrosstermEvent::Paste(_e) => sender.send(Event::Paste(())),
6767
}
6868
.expect("failed to send terminal event")
6969
}

0 commit comments

Comments
 (0)