mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:35:59 +02:00
Cut down unnecessary lint allows (#14335)
Trying to reduce lint allows either by checking if they are former false positives or by fixing the underlying warning. - **Remove dead `allow(dead_code)`** - **Remove recursive dead code** - **Remove dead code** - **Move test only functions to test module** The unit tests that use them, themselves are somewhat sus in that they mock the usage and not test specificly used methods of the implementation, so there is a risk for divergence - **Remove `clippy::uninit_vec` allow.** May have been a false positive, or the impl has changed somewhat. We certainly want to look at the unsafe code here to vet for correctness.
This commit is contained in:
committed by
GitHub
parent
7bd801a167
commit
455d32d9e5
@ -45,11 +45,6 @@ impl NuProgressBar {
|
||||
self.pb.set_position(bytes_processed);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn finished_msg(&self, msg: String) {
|
||||
self.pb.finish_with_message(msg);
|
||||
}
|
||||
|
||||
pub fn abandoned_msg(&self, msg: String) {
|
||||
self.pb.abandon_with_message(msg);
|
||||
}
|
||||
|
@ -291,42 +291,39 @@ fn positions_helper(blanks: &[usize], min_lines: usize) -> Vec<usize> {
|
||||
pos
|
||||
}
|
||||
|
||||
// to_rows returns rows separated by columns.
|
||||
#[allow(dead_code)]
|
||||
fn to_rows(lines: Vec<String>, pos: Vec<usize>, trim_space: bool) -> Vec<Vec<String>> {
|
||||
let mut rows: Vec<Vec<String>> = Vec::with_capacity(lines.len());
|
||||
for line in lines {
|
||||
let columns = split(&line, &pos, trim_space);
|
||||
rows.push(columns);
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
// to_table parses a slice of lines and returns a table.
|
||||
#[allow(dead_code)]
|
||||
pub fn to_table(lines: Vec<String>, header: usize, trim_space: bool) -> Vec<Vec<String>> {
|
||||
let pos = positions(&lines, header, 2);
|
||||
to_rows(lines, pos, trim_space)
|
||||
}
|
||||
|
||||
// to_table_n parses a slice of lines and returns a table, but limits the number of splits.
|
||||
#[allow(dead_code)]
|
||||
pub fn to_table_n(
|
||||
lines: Vec<String>,
|
||||
header: usize,
|
||||
num_split: usize,
|
||||
trim_space: bool,
|
||||
) -> Vec<Vec<String>> {
|
||||
let mut pos = positions(&lines, header, 2);
|
||||
if pos.len() > num_split {
|
||||
pos.truncate(num_split);
|
||||
}
|
||||
to_rows(lines, pos, trim_space)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{to_table, to_table_n, GuessWidth};
|
||||
use super::*;
|
||||
|
||||
/// to_rows returns rows separated by columns.
|
||||
fn to_rows(lines: Vec<String>, pos: Vec<usize>, trim_space: bool) -> Vec<Vec<String>> {
|
||||
let mut rows: Vec<Vec<String>> = Vec::with_capacity(lines.len());
|
||||
for line in lines {
|
||||
let columns = split(&line, &pos, trim_space);
|
||||
rows.push(columns);
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
/// to_table parses a slice of lines and returns a table.
|
||||
pub fn to_table(lines: Vec<String>, header: usize, trim_space: bool) -> Vec<Vec<String>> {
|
||||
let pos = positions(&lines, header, 2);
|
||||
to_rows(lines, pos, trim_space)
|
||||
}
|
||||
|
||||
/// to_table_n parses a slice of lines and returns a table, but limits the number of splits.
|
||||
pub fn to_table_n(
|
||||
lines: Vec<String>,
|
||||
header: usize,
|
||||
num_split: usize,
|
||||
trim_space: bool,
|
||||
) -> Vec<Vec<String>> {
|
||||
let mut pos = positions(&lines, header, 2);
|
||||
if pos.len() > num_split {
|
||||
pos.truncate(num_split);
|
||||
}
|
||||
to_rows(lines, pos, trim_space)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_guess_width_ps_trim() {
|
||||
|
Reference in New Issue
Block a user