Skip to content

Commit

Permalink
chore: clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Sep 19, 2024
1 parent ac65a59 commit dc98a84
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion edc-connector-tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl App {
AuthKind::NoAuth => (ConnectorStatus::Connected, Auth::NoAuth),
AuthKind::Token { token_alias } => {
let entry =
Entry::new(SERVICE, &token_alias).and_then(|entry| entry.get_password());
Entry::new(SERVICE, token_alias).and_then(|entry| entry.get_password());

match entry {
Ok(pwd) => (ConnectorStatus::Connected, Auth::api_token(pwd)),
Expand Down
2 changes: 1 addition & 1 deletion edc-connector-tui/src/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Component for Footer {
.noty
.as_ref()
.map(Footer::map_color)
.unwrap_or_else(Style::default);
.unwrap_or_default();

let text = Text::from(Span::styled(content, style));
let p = Paragraph::new(text)
Expand Down
2 changes: 1 addition & 1 deletion edc-connector-tui/src/components/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Component for HeaderComponent {
HeaderMsg::NextTab => {
let current = self.menu.clone();
let idx = (self.menu.ordinal() + 1) % Menu::VALUES.len();
self.menu = Menu::from_ordinal(idx).unwrap_or_else(|| current);
self.menu = Menu::from_ordinal(idx).unwrap_or(current);
Ok(ComponentReturn::action(super::Action::NavTo(
self.menu.clone().into(),
)))
Expand Down
6 changes: 3 additions & 3 deletions edc-connector-tui/src/components/resources/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl<T: DrawableResource> ResourceComponent<T> {

fn handle_key(&self, key: KeyEvent) -> Vec<ComponentMsg<ResourceMsg>> {
match key.code {
KeyCode::Char('j') => vec![(ComponentMsg(ResourceMsg::MoveDown.into()))],
KeyCode::Char('k') => vec![(ComponentMsg(ResourceMsg::MoveUp.into()))],
KeyCode::Char('y') => vec![(ComponentMsg(ResourceMsg::Yank.into()))],
KeyCode::Char('j') => vec![(ComponentMsg(ResourceMsg::MoveDown))],
KeyCode::Char('k') => vec![(ComponentMsg(ResourceMsg::MoveUp))],
KeyCode::Char('y') => vec![(ComponentMsg(ResourceMsg::Yank))],
_ => vec![],
}
}
Expand Down
2 changes: 1 addition & 1 deletion edc-connector-tui/src/components/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<T: TableEntry, M> UiTable<T, M> {
if let Some(cb) = self.on_select.as_ref() {
if let Some(idx) = self.table_state.selected() {
if let Some(element) = self.elements.get(idx) {
vec![ComponentMsg(TableMsg::Outer(cb(&element)))]
vec![ComponentMsg(TableMsg::Outer(cb(element)))]
} else {
vec![]
}
Expand Down
2 changes: 1 addition & 1 deletion edc-connector-tui/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Config {

let config: Result<Config, toml::de::Error> = toml::from_str(&contents);
match config {
Ok(config) => return Ok(config),
Ok(config) => Ok(config),
Err(e) => panic!("fail to parse config file: {}", e),
}
}
Expand Down
5 changes: 1 addition & 4 deletions edc-connector-tui/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ impl<C: Component + ActionHandler<Msg = <C as Component>::Msg> + Send> Runner<C>
if let Action::Spawn(handler) = a {
let inner_action_queue = action_queue.clone();
tokio::task::spawn(async move {
match handler.await {
Ok(action) => inner_action_queue.lock().await.push_back(action),
Err(_) => {}
}
if let Ok(action) = handler.await { inner_action_queue.lock().await.push_back(action) }
});
} else {
should_quit = should_quit || matches!(a, Action::Quit);
Expand Down
2 changes: 1 addition & 1 deletion edc-connector-tui/src/types/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl ConnectorStatus {
pub fn as_str(&self) -> &str {
match self {
ConnectorStatus::Connected => "connected",
ConnectorStatus::Custom(msg) => &msg,
ConnectorStatus::Custom(msg) => msg,
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions edc-connector-tui/src/types/nav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ impl Menu {
}
}

impl Into<Menu> for Nav {
fn into(self) -> Menu {
match self {
impl From<Nav> for Menu {
fn from(val: Nav) -> Self {
match val {
Nav::ConnectorsList => Menu::Connectors,
Nav::AssetsList => Menu::Assets,
Nav::PoliciesList => Menu::Policies,
Expand All @@ -56,9 +56,9 @@ impl Into<Menu> for Nav {
}
}

impl Into<Nav> for Menu {
fn into(self) -> Nav {
match self {
impl From<Menu> for Nav {
fn from(val: Menu) -> Self {
match val {
Menu::Connectors => Nav::ConnectorsList,
Menu::Assets => Nav::AssetsList,
Menu::Policies => Nav::PoliciesList,
Expand Down

0 comments on commit dc98a84

Please sign in to comment.