fix: make cargo check happy

This commit is contained in:
bestgopher
2024-12-04 20:47:28 +08:00
committed by weisd
parent d99086c5aa
commit a2fb252330
13 changed files with 22 additions and 33 deletions
+1 -2
View File
@@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use std::cell::LazyCell;
use std::collections::HashMap;
use std::env::var;
use time::format_description::BorrowedFormatItem;
use time::{Date, OffsetDateTime};
@@ -103,7 +102,7 @@ impl Credentials {
Self::check_key_value(header)
}
pub fn check_key_value(header: CredentialHeader) -> crate::Result<Self> {
pub fn check_key_value(_header: CredentialHeader) -> crate::Result<Self> {
todo!()
}
+4 -4
View File
@@ -93,7 +93,7 @@ impl CacheInner {
self.users.get(user_name).or_else(|| self.sts_accounts.get(user_name))
}
fn get_policy(&self, name: &str, groups: &[String]) -> crate::Result<Vec<Policy>> {
fn get_policy(&self, _name: &str, _groups: &[String]) -> crate::Result<Vec<Policy>> {
todo!()
}
@@ -126,13 +126,13 @@ impl CacheInner {
}
// todo
pub fn is_allowed_sts(&self, args: &Args, parent: &str) -> bool {
pub fn is_allowed_sts(&self, _args: &Args, _parent: &str) -> bool {
warn!("unimplement is_allowed_sts");
false
}
// todo
pub fn is_allowed_service_account(&self, args: &Args, parent: &str) -> bool {
pub fn is_allowed_service_account(&self, _args: &Args, _parent: &str) -> bool {
warn!("unimplement is_allowed_sts");
false
}
@@ -141,7 +141,7 @@ impl CacheInner {
todo!()
}
pub fn policy_db_get(&self, name: &str, groups: &[String]) -> Vec<String> {
pub fn policy_db_get(&self, _name: &str, _groups: &[String]) -> Vec<String> {
todo!()
}
}
-2
View File
@@ -1,5 +1,3 @@
use core::error;
use crate::policy;
#[derive(thiserror::Error, Debug)]
+6 -7
View File
@@ -1,13 +1,12 @@
use std::{borrow::Cow, collections::HashMap, f32::NAN};
use std::{borrow::Cow, collections::HashMap};
use log::{info, warn};
use time::OffsetDateTime;
use crate::{
arn::ARN,
auth::{Credentials, UserIdentity},
cache::{Cache, CacheInner},
policy::{utils::get_values_from_claims, Args, MappedPolicy, Policy, UserType},
auth::UserIdentity,
cache::CacheInner,
policy::{utils::get_values_from_claims, Args, Policy},
store::Store,
Error,
};
@@ -36,7 +35,7 @@ where
.or_else(|| self.cache.sts_accounts.get(user_name))
}
async fn get_policy(&self, name: &str, groups: &[String]) -> crate::Result<Vec<String>> {
async fn get_policy(&self, name: &str, _groups: &[String]) -> crate::Result<Vec<String>> {
if name.is_empty() {
return Err(Error::InvalidArgument);
}
@@ -122,7 +121,7 @@ where
false
}
pub async fn get_combined_policy(&self, policyes: &[String]) -> Policy {
pub async fn get_combined_policy(&self, _policies: &[String]) -> Policy {
todo!()
}
-2
View File
@@ -1,5 +1,3 @@
use std::default;
use serde::{Deserialize, Serialize};
use strum::{EnumString, IntoStaticStr};
+1 -2
View File
@@ -1,7 +1,6 @@
use std::{collections::HashMap, ops::Deref};
use func::Func;
use key::Key;
use serde::{de, Deserialize, Serialize};
pub mod addr;
@@ -56,7 +55,7 @@ impl<'de> Deserialize<'de> for Functions {
return Err(A::Error::custom("invalid codition"));
}
let Some(name) = name else { return Err(A::Error::custom("invalid codition")) };
let Some(_name) = name else { return Err(A::Error::custom("invalid codition")) };
let f = match qualifier {
Some("ForAnyValues") => Func::ForAnyValues,
-2
View File
@@ -1,5 +1,3 @@
use std::borrow::Cow;
use serde::{Deserialize, Serialize};
use super::{action::Action, ActionSet, Args, Effect, Error, Functions, ResourceSet, Validator, ID};
-2
View File
@@ -1,5 +1,3 @@
use std::{fmt::Write, usize};
struct LazyBuf<'a> {
s: &'a str,
buf: Option<Vec<u8>>,
+3 -3
View File
@@ -6,14 +6,14 @@ use ecstore::{
store_api::{HTTPRangeSpec, ObjectIO, ObjectInfo, ObjectOptions, PutObjReader},
utils::path::dir,
};
use futures::{future::try_join_all, SinkExt};
use futures::future::try_join_all;
use log::debug;
use serde::{de::DeserializeOwned, Serialize};
use super::Store;
use crate::{
auth::UserIdentity,
cache::{Cache, CacheEntity, CacheInner},
cache::{Cache, CacheEntity},
policy::{utils::split_path, MappedPolicy, PolicyDoc, UserType},
Error,
};
@@ -102,7 +102,7 @@ impl ObjectStore {
Ok(Some(user))
}
async fn load_mapped_policy(&self, user_type: UserType, name: &str, is_group: bool) -> crate::Result<MappedPolicy> {
async fn load_mapped_policy(&self, user_type: UserType, name: &str, _is_group: bool) -> crate::Result<MappedPolicy> {
let (p, _) = self
.load_iam_config::<MappedPolicy>(&format!("{base}{name}.json", base = user_type.prefix(), name = name))
.await?;