Skip to content

Commit

Permalink
Fix cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiburt committed Mar 25, 2024
1 parent 7ec7973 commit c0fea92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions json_to_table/src/table/collapsed_table.rs
Expand Up @@ -108,7 +108,7 @@ fn _collapsed_table(val: &Value, cfg: &Config, dims: &Dimensions, ctx: PrintCont
}

fn generate_vertical_array(
list: &Vec<Value>,
list: &[Value],
cfg: &Config,
dims: &Dimensions,
ctx: PrintContext,
Expand Down Expand Up @@ -178,7 +178,7 @@ fn generate_vertical_array(
}

fn generate_horizontal_array(
list: &Vec<Value>,
list: &[Value],
cfg: &Config,
dims: &Dimensions,
ctx: PrintContext,
Expand Down
2 changes: 1 addition & 1 deletion papergrid/src/records/vec_records/mod.rs
Expand Up @@ -26,7 +26,7 @@ impl<T> VecRecords<T> {
///
/// It assumes that data vector has all rows has the same length().
pub fn new(data: Vec<Vec<T>>) -> Self {
let count_columns = data.get(0).map_or(0, |row| row.len());
let count_columns = data.first().map_or(0, |row| row.len());
let count_rows = data.len();
let shape = (count_rows, count_columns);

Expand Down
4 changes: 2 additions & 2 deletions table_to_html/tests/html.rs
Expand Up @@ -70,7 +70,7 @@ fn html_element_visitor() {

#[test]
fn html_element_visitor_mut() {
struct Visitor(usize);
struct Visitor;

impl HtmlVisitorMut for Visitor {
fn visit_element_mut(&mut self, e: &mut HtmlElement) -> bool {
Expand Down Expand Up @@ -108,7 +108,7 @@ fn html_element_visitor_mut() {
)])),
);

let mut visitor = Visitor(0);
let mut visitor = Visitor;
table.visit_mut(&mut visitor);

assert_table!(
Expand Down
8 changes: 4 additions & 4 deletions tabled/src/grid/records/resizable.rs
Expand Up @@ -94,7 +94,7 @@ where
}

fn push_row(&mut self) {
let count_columns = self.get(0).map(|l| l.len()).unwrap_or(0);
let count_columns = self.first().map(|l| l.len()).unwrap_or(0);
self.push(vec![T::default(); count_columns]);
}

Expand All @@ -115,7 +115,7 @@ where
}

fn insert_row(&mut self, row: usize) {
let count_columns = self.get(0).map(|l| l.len()).unwrap_or(0);
let count_columns = self.first().map(|l| l.len()).unwrap_or(0);
self.insert(row, vec![T::default(); count_columns]);
}

Expand Down Expand Up @@ -157,7 +157,7 @@ where
let records = std::mem::replace(self, VecRecords::new(vec![]));
let mut data: Vec<Vec<_>> = records.into();

let count_columns = data.get(0).map(|l| l.len()).unwrap_or(0);
let count_columns = data.first().map(|l| l.len()).unwrap_or(0);
data.push(vec![T::default(); count_columns]);

*self = VecRecords::new(data);
Expand Down Expand Up @@ -198,7 +198,7 @@ where
let records = std::mem::replace(self, VecRecords::new(vec![]));
let mut data: Vec<Vec<_>> = records.into();

let count_columns = data.get(0).map(|l| l.len()).unwrap_or(0);
let count_columns = data.first().map(|l| l.len()).unwrap_or(0);
data.insert(row, vec![T::default(); count_columns]);

*self = VecRecords::new(data);
Expand Down
4 changes: 2 additions & 2 deletions tabled/src/tables/table_pool.rs
Expand Up @@ -355,7 +355,7 @@ mod print {
}

fn generate_table_column(
list: &Vec<TableValue>,
list: &[TableValue],
cfg: &CompactMultilineConfig,
dims: &Dimensions,
priority: PoolTableDimension,
Expand Down Expand Up @@ -444,7 +444,7 @@ mod print {
}

fn generate_table_row(
list: &Vec<TableValue>,
list: &[TableValue],
cfg: &CompactMultilineConfig,
dims: &Dimensions,
priority: PoolTableDimension,
Expand Down

0 comments on commit c0fea92

Please sign in to comment.