Fix clippy (#15489)

# Description
There are some clippy(version 0.1.86) errors on nushell repo. This pr is
trying to fix it.

# User-Facing Changes
Hopefully none.

# Tests + Formatting
NaN

# After Submitting
NaN
This commit is contained in:
Wind
2025-04-06 09:49:28 +08:00
committed by GitHub
parent 67ea25afca
commit 1c6c85d35d
19 changed files with 30 additions and 35 deletions

View File

@@ -39,15 +39,15 @@
//! that dictate how the grid is formatted:
//!
//! - `filling`: what to put in between two columns — either a number of
//! spaces, or a text string;
//! spaces, or a text string;
//! - `direction`, which specifies whether the cells should go along
//! rows, or columns:
//! rows, or columns:
//! - `Direction::LeftToRight` starts them in the top left and
//! moves *rightwards*, going to the start of a new row after reaching the
//! final column;
//! moves *rightwards*, going to the start of a new row after reaching the
//! final column;
//! - `Direction::TopToBottom` starts them in the top left and moves
//! *downwards*, going to the top of a new column after reaching the final
//! row.
//! *downwards*, going to the top of a new column after reaching the final
//! row.
//!
//!
//! ## Displaying a grid
@@ -93,7 +93,7 @@
use std::cmp::max;
use std::fmt;
use std::iter::repeat;
use std::iter::repeat_n;
use unicode_width::UnicodeWidthStr;
fn unicode_width_strip_ansi(astring: &str) -> usize {
@@ -290,7 +290,7 @@ impl Grid {
}
fn column_widths(&self, num_lines: usize, num_columns: usize) -> Dimensions {
let mut widths: Vec<Width> = repeat(0).take(num_columns).collect();
let mut widths: Vec<Width> = repeat_n(0, num_columns).collect();
for (index, cell) in self.cells.iter().enumerate() {
let index = match self.options.direction {
Direction::LeftToRight => index % num_columns,