Clippy pedantic

This commit is contained in:
Guilleag01
2025-11-19 22:04:18 +01:00
parent 28cb8c587b
commit a4cf1c1973
6 changed files with 6 additions and 5 deletions

View File

@@ -6,5 +6,5 @@ edition = "2021"
[dependencies] [dependencies]
chrono = "0.4.31" chrono = "0.4.31"
clap = { version = "4.4.7", features = ["derive"] } clap = { version = "4.4.7", features = ["derive"] }
colored = "2.0.4" colored = "3.0.0"
term_size = "0.3.2" term_size = "0.3.2"

View File

@@ -37,7 +37,7 @@ impl Element {
return Self { return Self {
path: path_str.to_string(), path: path_str.to_string(),
file_type: TypeOfFile::File, file_type: TypeOfFile::File,
name: path_str.split('/').last().unwrap().to_string(), name: path_str.split('/').next_back().unwrap().to_string(),
perms: None, perms: None,
size: 0, size: 0,
creation: SystemTime::UNIX_EPOCH, creation: SystemTime::UNIX_EPOCH,

View File

@@ -1,3 +1,4 @@
#![warn(clippy::pedantic)]
use clap::Parser; use clap::Parser;
use lsplus::{ use lsplus::{
out::{default::default, list::list}, out::{default::default, list::list},

View File

@@ -11,7 +11,7 @@ pub fn default(mut elements: Vec<Element>) {
let mut num_columns = 1; let mut num_columns = 1;
let mut column_widths: Vec<usize> = Vec::new(); let mut column_widths: Vec<usize> = Vec::new();
let mut total = std::usize::MAX; let mut total = usize::MAX;
while total >= width - 1 { while total >= width - 1 {
total = 0; total = 0;
num_columns = (elements.len() as f32 / i as f32).ceil() as usize; num_columns = (elements.len() as f32 / i as f32).ceil() as usize;

View File

@@ -42,7 +42,7 @@ fn print_header(name_length: usize) {
} }
fn print_elements( fn print_elements(
elements: &mut Vec<Element>, elements: &mut [Element],
name_length: usize, name_length: usize,
recursive_limit: usize, recursive_limit: usize,
current_depth: usize, current_depth: usize,

View File

@@ -89,7 +89,7 @@ pub fn sort_elements(elements: &mut [Element], sort_by: &SortBy) {
// ALL ICONS MUST BE FOLLOWED BY A SPACE // ALL ICONS MUST BE FOLLOWED BY A SPACE
pub fn get_icon_file_type<'a>(filename: String) -> &'a str { pub fn get_icon_file_type<'a>(filename: String) -> &'a str {
let extension = filename.split('.').last().unwrap(); let extension = filename.split('.').next_back().unwrap();
match extension.to_lowercase().as_str() { match extension.to_lowercase().as_str() {
"jpg" | "jpeg" | "png" | "bmp" | "gif" | "webp" | "svg" => "󰋩 ", "jpg" | "jpeg" | "png" | "bmp" | "gif" | "webp" | "svg" => "󰋩 ",
"zip" | "rar" | "7zip" | "tar" | "gz" | "tgz" => "󰗄 ", "zip" | "rar" | "7zip" | "tar" | "gz" | "tgz" => "󰗄 ",