fix: lint

This commit is contained in:
veeso
2024-07-08 14:48:03 +02:00
parent 4f3b97b198
commit 88cdae79a8
3 changed files with 40 additions and 29 deletions

View File

@@ -10,7 +10,6 @@ use std::cmp::Reverse;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::string::ToString;
use formatter::Formatter; use formatter::Formatter;
// Ext // Ext
@@ -243,14 +242,18 @@ impl FileExplorer {
// Traits // Traits
impl ToString for FileSorting { impl std::fmt::Display for FileSorting {
fn to_string(&self) -> String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
String::from(match self { write!(
f,
"{}",
match self {
FileSorting::CreationTime => "by_creation_time", FileSorting::CreationTime => "by_creation_time",
FileSorting::ModifyTime => "by_mtime", FileSorting::ModifyTime => "by_mtime",
FileSorting::Name => "by_name", FileSorting::Name => "by_name",
FileSorting::Size => "by_size", FileSorting::Size => "by_size",
}) }
)
} }
} }
@@ -267,12 +270,16 @@ impl FromStr for FileSorting {
} }
} }
impl ToString for GroupDirs { impl std::fmt::Display for GroupDirs {
fn to_string(&self) -> String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
String::from(match self { write!(
f,
"{}",
match self {
GroupDirs::First => "first", GroupDirs::First => "first",
GroupDirs::Last => "last", GroupDirs::Last => "last",
}) }
)
} }
} }

View File

@@ -23,9 +23,12 @@ pub enum FileTransferProtocol {
// Traits // Traits
impl std::string::ToString for FileTransferProtocol { impl std::fmt::Display for FileTransferProtocol {
fn to_string(&self) -> String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
String::from(match self { write!(
f,
"{}",
match self {
FileTransferProtocol::AwsS3 => "S3", FileTransferProtocol::AwsS3 => "S3",
FileTransferProtocol::Ftp(secure) => match secure { FileTransferProtocol::Ftp(secure) => match secure {
true => "FTPS", true => "FTPS",
@@ -35,7 +38,8 @@ impl std::string::ToString for FileTransferProtocol {
FileTransferProtocol::Sftp => "SFTP", FileTransferProtocol::Sftp => "SFTP",
FileTransferProtocol::Smb => "SMB", FileTransferProtocol::Smb => "SMB",
FileTransferProtocol::WebDAV => "WEBDAV", FileTransferProtocol::WebDAV => "WEBDAV",
}) }
)
} }
} }

View File

@@ -81,7 +81,7 @@ impl Store {
/// Check if a state is set in the store /// Check if a state is set in the store
pub fn isset(&self, key: &str) -> bool { pub fn isset(&self, key: &str) -> bool {
self.store.get(key).is_some() self.store.contains_key(key)
} }
// -- setters // -- setters