run clippy fixes

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2024-08-01 18:11:28 -04:00
parent b719c4e711
commit dbf46e3d0e
No known key found for this signature in database
GPG key ID: 6577287BDCA70840
5 changed files with 12 additions and 15 deletions

View file

@ -37,7 +37,7 @@ impl HTTPNodeClient {
pub fn new(node_url: &str, node_api_secret: Option<String>) -> HTTPNodeClient {
HTTPNodeClient {
node_url: node_url.to_owned(),
node_api_secret: node_api_secret,
node_api_secret,
}
}
fn send_json_request<D: serde::de::DeserializeOwned>(

View file

@ -41,7 +41,7 @@ pub fn create() -> impl View {
main_menu.get_mut().add_item("Logs", VIEW_LOGS);
main_menu.get_mut().add_item("Version Info", VIEW_VERSION);
let change_view = |s: &mut Cursive, v: &&str| {
if *v == "" {
if v.is_empty() {
return;
}
@ -76,12 +76,12 @@ pub fn create() -> impl View {
s.select_down(1)(c);
}
});
let main_menu = LinearLayout::new(Orientation::Vertical)
LinearLayout::new(Orientation::Vertical)
.child(ResizedView::with_full_height(main_menu))
.child(TextView::new("------------------"))
.child(TextView::new("Tab/Arrow : Cycle "))
.child(TextView::new("Enter : Select"))
.child(TextView::new("Esc : Back "))
.child(TextView::new("Q : Quit "));
main_menu
.child(TextView::new("Q : Quit "))
}

View file

@ -110,7 +110,7 @@ impl TableViewItem<PeerColumn> for PeerStats {
match column {
PeerColumn::Address => sort_by_addr(),
PeerColumn::State => self.state.cmp(&other.state).then(sort_by_addr()),
PeerColumn::UsedBandwidth => cmp_used_bandwidth(&self, &other).then(sort_by_addr()),
PeerColumn::UsedBandwidth => cmp_used_bandwidth(self, other).then(sort_by_addr()),
PeerColumn::TotalDifficulty => self
.total_difficulty
.cmp(&other.total_difficulty)
@ -162,12 +162,9 @@ impl TUIPeerView {
)
.with_name(VIEW_PEER_SYNC);
let peer_status_view =
OnEventView::new(peer_status_view).on_pre_event(Key::Esc, move |c| {
let _ = c.focus_name(MAIN_MENU);
});
peer_status_view
OnEventView::new(peer_status_view).on_pre_event(Key::Esc, move |c| {
let _ = c.focus_name(MAIN_MENU);
})
}
}

View file

@ -81,7 +81,7 @@ impl TUIStatusView {
Cow::Owned(format!("Sync step 2/7: Downloading {}(MB) chain state for state sync: {}% at {:.1?}(kB/s)",
stat.total_size / 1_000_000,
percent,
if dur_ms > 1.0f64 { stat.downloaded_size.saturating_sub(stat.prev_downloaded_size) as f64 / dur_ms as f64 } else { 0f64 },
if dur_ms > 1.0f64 { stat.downloaded_size.saturating_sub(stat.prev_downloaded_size) as f64 / dur_ms } else { 0f64 },
))
} else {
let start = stat.start_time.timestamp_millis();

View file

@ -27,12 +27,12 @@ fn main() {
if cfg!(target_os = "windows") {
Command::new("cmd")
.args(&["/C", &git_hooks])
.args(["/C", &git_hooks])
.output()
.expect("failed to execute git config for hooks");
} else {
Command::new("sh")
.args(&["-c", &git_hooks])
.args(["-c", &git_hooks])
.output()
.expect("failed to execute git config for hooks");
}