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

View File

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

View File

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