fix: resolve clippy warnings for inherent to_string method shadowing Display trait

This commit is contained in:
weisd
2025-06-30 21:51:19 +08:00
parent 24738dc635
commit e4971b6d83
3 changed files with 74 additions and 79 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ impl TierConfigMgr {
if cfg.is_none() {
return "internal".to_string();
}
cfg.expect("err").tier_type.to_string()
cfg.expect("err").tier_type.as_lowercase()
}
pub fn list_tiers(&self) -> Vec<TierConfig> {
+11 -5
View File
@@ -51,7 +51,7 @@ impl TierType {
}
}
pub fn to_string(&self) -> String {
pub fn as_lowercase(&self) -> String {
match self {
TierType::S3 => "s3".to_string(),
TierType::RustFS => "rustfs".to_string(),
@@ -199,11 +199,17 @@ pub struct TierS3 {
impl TierS3 {
#[allow(dead_code)]
fn new<F>(name: &str, access_key: &str, secret_key: &str, bucket: &str, options: Vec<F>) -> Result<TierConfig, std::io::Error>
fn create<F>(
name: &str,
access_key: &str,
secret_key: &str,
bucket: &str,
options: Vec<F>,
) -> Result<TierConfig, std::io::Error>
where
F: Fn(TierS3) -> Box<Result<(), std::io::Error>> + Send + Sync + 'static,
{
if name == "" {
if name.is_empty() {
return Err(std::io::Error::other(ERR_TIER_NAME_EMPTY));
}
let sc = TierS3 {
@@ -264,7 +270,7 @@ pub struct TierMinIO {
impl TierMinIO {
#[allow(dead_code)]
fn new<F>(
fn create<F>(
name: &str,
endpoint: &str,
access_key: &str,
@@ -275,7 +281,7 @@ impl TierMinIO {
where
F: Fn(TierMinIO) -> Box<Result<(), std::io::Error>> + Send + Sync + 'static,
{
if name == "" {
if name.is_empty() {
return Err(std::io::Error::other(ERR_TIER_NAME_EMPTY));
}
let m = TierMinIO {