mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 23:26:53 +00:00
fix:Apply suggestions from clippy 1.88
This commit is contained in:
+2
-2
@@ -119,7 +119,7 @@ impl Clone for Error {
|
||||
match self {
|
||||
Error::PolicyError(e) => Error::StringError(e.to_string()), // Convert to string since PolicyError may not be cloneable
|
||||
Error::StringError(s) => Error::StringError(s.clone()),
|
||||
Error::CryptoError(e) => Error::StringError(format!("crypto: {}", e)), // Convert to string
|
||||
Error::CryptoError(e) => Error::StringError(format!("crypto: {e}")), // Convert to string
|
||||
Error::NoSuchUser(s) => Error::NoSuchUser(s.clone()),
|
||||
Error::NoSuchAccount(s) => Error::NoSuchAccount(s.clone()),
|
||||
Error::NoSuchServiceAccount(s) => Error::NoSuchServiceAccount(s.clone()),
|
||||
@@ -137,7 +137,7 @@ impl Clone for Error {
|
||||
Error::InvalidSecretKeyLength => Error::InvalidSecretKeyLength,
|
||||
Error::ContainsReservedChars => Error::ContainsReservedChars,
|
||||
Error::GroupNameContainsReservedChars => Error::GroupNameContainsReservedChars,
|
||||
Error::JWTError(e) => Error::StringError(format!("jwt err {}", e)), // Convert to string
|
||||
Error::JWTError(e) => Error::StringError(format!("jwt err {e}")), // Convert to string
|
||||
Error::NoAccessKey => Error::NoAccessKey,
|
||||
Error::InvalidToken => Error::InvalidToken,
|
||||
Error::InvalidAccessKey => Error::InvalidAccessKey,
|
||||
|
||||
+11
-11
@@ -64,15 +64,15 @@ fn get_policy_doc_path(name: &str) -> String {
|
||||
|
||||
fn get_mapped_policy_path(name: &str, user_type: UserType, is_group: bool) -> String {
|
||||
if is_group {
|
||||
return path_join_buf(&[&IAM_CONFIG_POLICY_DB_GROUPS_PREFIX, format!("{}.json", name).as_str()]);
|
||||
return path_join_buf(&[&IAM_CONFIG_POLICY_DB_GROUPS_PREFIX, format!("{name}.json").as_str()]);
|
||||
}
|
||||
match user_type {
|
||||
UserType::Svc => path_join_buf(&[
|
||||
&IAM_CONFIG_POLICY_DB_SERVICE_ACCOUNTS_PREFIX,
|
||||
format!("{}.json", name).as_str(),
|
||||
format!("{name}.json").as_str(),
|
||||
]),
|
||||
UserType::Sts => path_join_buf(&[&IAM_CONFIG_POLICY_DB_STS_USERS_PREFIX, format!("{}.json", name).as_str()]),
|
||||
_ => path_join_buf(&[&IAM_CONFIG_POLICY_DB_USERS_PREFIX, format!("{}.json", name).as_str()]),
|
||||
UserType::Sts => path_join_buf(&[&IAM_CONFIG_POLICY_DB_STS_USERS_PREFIX, format!("{name}.json").as_str()]),
|
||||
_ => path_join_buf(&[&IAM_CONFIG_POLICY_DB_USERS_PREFIX, format!("{name}.json").as_str()]),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ impl ObjectStore {
|
||||
Ok(p) => Ok(p),
|
||||
Err(err) => {
|
||||
if !is_err_no_such_policy(&err) {
|
||||
Err(Error::other(format!("load policy doc failed: {}", err)))
|
||||
Err(Error::other(format!("load policy doc failed: {err}")))
|
||||
} else {
|
||||
Ok(PolicyDoc::default())
|
||||
}
|
||||
@@ -244,7 +244,7 @@ impl ObjectStore {
|
||||
Ok(res) => Ok(res),
|
||||
Err(err) => {
|
||||
if !is_err_no_such_user(&err) {
|
||||
Err(Error::other(format!("load user failed: {}", err)))
|
||||
Err(Error::other(format!("load user failed: {err}")))
|
||||
} else {
|
||||
Ok(UserIdentity::default())
|
||||
}
|
||||
@@ -295,7 +295,7 @@ impl ObjectStore {
|
||||
Ok(p) => Ok(p),
|
||||
Err(err) => {
|
||||
if !is_err_no_such_policy(&err) {
|
||||
Err(Error::other(format!("load mapped policy failed: {}", err)))
|
||||
Err(Error::other(format!("load mapped policy failed: {err}")))
|
||||
} else {
|
||||
Ok(MappedPolicy::default())
|
||||
}
|
||||
@@ -767,7 +767,7 @@ impl Store for ObjectStore {
|
||||
let name = rustfs_utils::path::dir(item);
|
||||
info!("load group: {}", name);
|
||||
if let Err(err) = self.load_group(&name, &mut items_cache).await {
|
||||
return Err(Error::other(format!("load group failed: {}", err)));
|
||||
return Err(Error::other(format!("load group failed: {err}")));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -828,7 +828,7 @@ impl Store for ObjectStore {
|
||||
info!("load group policy: {}", name);
|
||||
if let Err(err) = self.load_mapped_policy(name, UserType::Reg, true, &mut items_cache).await {
|
||||
if !is_err_no_such_policy(&err) {
|
||||
return Err(Error::other(format!("load group policy failed: {}", err)));
|
||||
return Err(Error::other(format!("load group policy failed: {err}")));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -847,7 +847,7 @@ impl Store for ObjectStore {
|
||||
info!("load svc user: {}", name);
|
||||
if let Err(err) = self.load_user(&name, UserType::Svc, &mut items_cache).await {
|
||||
if !is_err_no_such_user(&err) {
|
||||
return Err(Error::other(format!("load svc user failed: {}", err)));
|
||||
return Err(Error::other(format!("load svc user failed: {err}")));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -861,7 +861,7 @@ impl Store for ObjectStore {
|
||||
.await
|
||||
{
|
||||
if !is_err_no_such_policy(&err) {
|
||||
return Err(Error::other(format!("load_mapped_policy failed: {}", err)));
|
||||
return Err(Error::other(format!("load_mapped_policy failed: {err}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ mod tests {
|
||||
|
||||
for invalid_token in &invalid_tokens {
|
||||
let result = extract_claims::<Claims>(invalid_token, "secret");
|
||||
assert!(result.is_err(), "Should fail with invalid token: {}", invalid_token);
|
||||
assert!(result.is_err(), "Should fail with invalid token: {invalid_token}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user