fix(policy): remove six dead error variants (#6631)

Backlog#1845 step 8 prerequisite. policy::error::Error carried six variants with zero construction and zero match sites anywhere in the workspace: ErrCredMalformed, CredNotInitialized, NoAccessKey, InvalidToken, InvalidAccessKey, InvalidExpiration. Their only reference was the grouped fallthrough arm in iam's From<policy::error::Error>, whose own dead same-name twins were already removed in backlog#1831 (#6030).

Delete the variants and their display-message test rows; the iam mapping's grouped arm shrinks from eight variants to the two that are actually produced (InvalidServiceType from service_type parsing, JWTError via #[from]). This clears the way for folding the remaining 25-arm hand-written mapping (backlog#1845 step 8).

Ref rustfs/backlog#1845
This commit is contained in:
Zhengchao An
2026-08-26 13:24:36 +08:00
committed by GitHub
parent 8f0d4a20d1
commit b610d5a55d
2 changed files with 5 additions and 33 deletions
+5 -9
View File
@@ -214,15 +214,11 @@ impl From<rustfs_policy::error::Error> for Error {
rustfs_policy::error::Error::IamSysAlreadyInitialized => Error::IamSysAlreadyInitialized,
// These policy variants had dead same-name twins on iam::Error (zero
// construction and zero match sites, removed in backlog#1831); the
// message is preserved through StringError instead.
err @ (rustfs_policy::error::Error::InvalidServiceType(_)
| rustfs_policy::error::Error::InvalidExpiration
| rustfs_policy::error::Error::NoAccessKey
| rustfs_policy::error::Error::InvalidToken
| rustfs_policy::error::Error::InvalidAccessKey
| rustfs_policy::error::Error::JWTError(_)
| rustfs_policy::error::Error::CredNotInitialized
| rustfs_policy::error::Error::ErrCredMalformed) => Error::StringError(err.to_string()),
// message is preserved through StringError instead. Their six dead
// siblings on policy::Error were deleted outright (backlog#1845).
err @ (rustfs_policy::error::Error::InvalidServiceType(_) | rustfs_policy::error::Error::JWTError(_)) => {
Error::StringError(err.to_string())
}
}
}
}