Skip to content

Commit

Permalink
[refactor]: cargo clippy --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
woxjro committed Oct 29, 2023
1 parent ce52fea commit dd0eb36
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/app/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ impl From<usize> for SelectableBlockDetailItem {
}
}

impl Into<usize> for SelectableBlockDetailItem {
fn into(self) -> usize {
match self {
Self::Transactions => 0,
Self::Withdrawls => 1,
Self::FeeRecipient => 2,
Self::ParentHash => 3,
impl From<SelectableBlockDetailItem> for usize {
fn from(val: SelectableBlockDetailItem) -> Self {
match val {
SelectableBlockDetailItem::Transactions => 0,
SelectableBlockDetailItem::Withdrawls => 1,
SelectableBlockDetailItem::FeeRecipient => 2,
SelectableBlockDetailItem::ParentHash => 3,
}
}
}
10 changes: 5 additions & 5 deletions src/app/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ impl From<usize> for SelectableTransactionDetailItem {
}
}

impl Into<usize> for SelectableTransactionDetailItem {
fn into(self) -> usize {
match self {
Self::From => 0,
Self::To => 1,
impl From<SelectableTransactionDetailItem> for usize {
fn from(val: SelectableTransactionDetailItem) -> Self {
match val {
SelectableTransactionDetailItem::From => 0,
SelectableTransactionDetailItem::To => 1,
}
}
}
8 changes: 4 additions & 4 deletions src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ impl<T> StatefulList<T> {
let i = match self.state.selected() {
Some(i) => {
if i >= self.items.len() - 1 + self.header_size {
0 + self.header_size
self.header_size
} else {
i + 1
}
}
None => 0 + self.header_size,
None => self.header_size,
};
self.state.select(Some(i));
}

pub fn previous(&mut self) {
let i = match self.state.selected() {
Some(i) => {
if i <= 0 + self.header_size {
if i <= self.header_size {
self.items.len() - 1 + self.header_size
} else {
i - 1
}
}
None => 0 + self.header_size,
None => self.header_size,
};
self.state.select(Some(i));
}
Expand Down

0 comments on commit dd0eb36

Please sign in to comment.