Skip to content

Commit

Permalink
make Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed Apr 13, 2024
1 parent d4135a6 commit 82f7355
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/nu/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) enum Table {
RowIncompatibleLen(usize, usize, usize),
RowIncompatibleType(usize, String, Type, Type),
RowInvalidKey(usize, String, Vec<String>),
IsTable,
IsValid,
NotAList,
}

Expand Down Expand Up @@ -143,7 +143,7 @@ pub(crate) fn is_table(value: &Value) -> Table {
}
}

Table::IsTable
Table::IsValid
}
_ => Table::NotAList,
}
Expand Down Expand Up @@ -178,7 +178,7 @@ pub(crate) fn is_table(value: &Value) -> Table {
/// }
/// ```
pub(crate) fn transpose(value: &Value) -> Value {
if matches!(is_table(value), Table::IsTable) {
if matches!(is_table(value), Table::IsValid) {
let value_rows = match value {
Value::List { vals, .. } => vals,
_ => return value.clone(),
Expand Down Expand Up @@ -432,7 +432,7 @@ mod tests {
]);
assert_eq!(
is_table(&table),
Table::IsTable,
Table::IsValid,
"{} should be a table",
default_value_repr(&table)
);
Expand All @@ -449,7 +449,7 @@ mod tests {
]);
assert_eq!(
is_table(&table_with_out_of_order_columns),
Table::IsTable,
Table::IsValid,
"{} should be a table",
default_value_repr(&table_with_out_of_order_columns)
);
Expand All @@ -466,7 +466,7 @@ mod tests {
]);
assert_eq!(
is_table(&table_with_nulls),
Table::IsTable,
Table::IsValid,
"{} should be a table",
default_value_repr(&table_with_nulls)
);
Expand All @@ -483,7 +483,7 @@ mod tests {
]);
assert_eq!(
is_table(&table_with_number_colum),
Table::IsTable,
Table::IsValid,
"{} should be a table",
default_value_repr(&table_with_number_colum)
);
Expand Down
18 changes: 8 additions & 10 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ fn render_data(frame: &mut Frame, app: &App, config: &Config) {
});

let table_type = is_table(&value);
let is_a_table = matches!(table_type, crate::nu::value::Table::IsTable);
let is_a_table = matches!(table_type, crate::nu::value::Table::IsValid);

let mut data_frame_height = if config.show_cell_path {
frame.size().height - 2
Expand All @@ -271,19 +271,17 @@ fn render_data(frame: &mut Frame, app: &App, config: &Config) {
i, k, ks
)),
crate::nu::value::Table::NotAList => None,
crate::nu::value::Table::IsTable => unreachable!(),
crate::nu::value::Table::IsValid => unreachable!(),
};

if msg.is_some() {
if let Some(msg) = msg {
data_frame_height -= 1;
frame.render_widget(
Paragraph::new(msg.unwrap())
.alignment(Alignment::Right)
.style(
Style::default()
.bg(config.colors.warning.background)
.fg(config.colors.warning.foreground),
),
Paragraph::new(msg).alignment(Alignment::Right).style(
Style::default()
.bg(config.colors.warning.background)
.fg(config.colors.warning.foreground),
),
Rect::new(0, data_frame_height, frame.size().width, 1),
);
}
Expand Down

0 comments on commit 82f7355

Please sign in to comment.