diff --git a/src/nu/value.rs b/src/nu/value.rs index 592f76f..2e5e84f 100644 --- a/src/nu/value.rs +++ b/src/nu/value.rs @@ -12,7 +12,7 @@ pub(crate) enum Table { RowIncompatibleLen(usize, usize, usize), RowIncompatibleType(usize, String, Type, Type), RowInvalidKey(usize, String, Vec), - IsTable, + IsValid, NotAList, } @@ -143,7 +143,7 @@ pub(crate) fn is_table(value: &Value) -> Table { } } - Table::IsTable + Table::IsValid } _ => Table::NotAList, } @@ -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(), @@ -432,7 +432,7 @@ mod tests { ]); assert_eq!( is_table(&table), - Table::IsTable, + Table::IsValid, "{} should be a table", default_value_repr(&table) ); @@ -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) ); @@ -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) ); @@ -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) ); diff --git a/src/ui.rs b/src/ui.rs index 77deeb2..01438fe 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -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 @@ -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), ); }