Skip to content

Commit 41872b2

Browse files
committed
Fix lint
1 parent f80a60c commit 41872b2

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed

object_store/src/aws/client.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl TryFrom<ListContents> for ObjectMeta {
164164
type Error = crate::Error;
165165

166166
fn try_from(value: ListContents) -> Result<Self> {
167-
Ok(ObjectMeta {
167+
Ok(Self {
168168
location: Path::parse(value.key)?,
169169
last_modified: value.last_modified,
170170
size: value.size,
@@ -230,7 +230,10 @@ impl S3Client {
230230
}
231231

232232
async fn get_credential(&self) -> Result<Arc<AwsCredential>> {
233-
self.config.credentials.get_credential(&self.client, &self.config.retry_config).await
233+
self.config
234+
.credentials
235+
.get_credential(&self.client, &self.config.retry_config)
236+
.await
234237
}
235238

236239
/// Make an S3 GET request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html>
@@ -271,7 +274,7 @@ impl S3Client {
271274
}
272275

273276
/// Make an S3 PUT request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html>
274-
pub async fn put_request<T: Serialize + ?Sized>(
277+
pub async fn put_request<T: Serialize + ?Sized + Sync>(
275278
&self,
276279
path: &Path,
277280
bytes: Option<Bytes>,
@@ -302,7 +305,7 @@ impl S3Client {
302305
}
303306

304307
/// Make an S3 Delete request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html>
305-
pub async fn delete_request<T: Serialize>(
308+
pub async fn delete_request<T: Serialize + ?Sized + Sync>(
306309
&self,
307310
path: &Path,
308311
query: &T,
@@ -374,7 +377,7 @@ impl S3Client {
374377
query.push(("list-type", "2"));
375378

376379
if let Some(prefix) = prefix {
377-
query.push(("prefix", prefix.as_ref()))
380+
query.push(("prefix", prefix))
378381
}
379382

380383
let response = self

object_store/src/aws/credential.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ struct RequestSigner<'a> {
6868
region: &'a str,
6969
}
7070

71-
const DATE_HEADER: &'static str = "x-amz-date";
72-
const HASH_HEADER: &'static str = "x-amz-content-sha256";
73-
const TOKEN_HEADER: &'static str = "x-amz-security-token";
74-
const AUTH_HEADER: &'static str = "authorization";
71+
const DATE_HEADER: &str = "x-amz-date";
72+
const HASH_HEADER: &str = "x-amz-content-sha256";
73+
const TOKEN_HEADER: &str = "x-amz-security-token";
74+
const AUTH_HEADER: &str = "authorization";
7575

76-
const ALL_HEADERS: &[&'static str; 4] =
77-
&[DATE_HEADER, HASH_HEADER, TOKEN_HEADER, AUTH_HEADER];
76+
const ALL_HEADERS: &[&str; 4] = &[DATE_HEADER, HASH_HEADER, TOKEN_HEADER, AUTH_HEADER];
7877

7978
impl<'a> RequestSigner<'a> {
8079
fn sign(&self, request: &mut Request) {
@@ -269,7 +268,7 @@ impl CredentialProvider {
269268
retry_config: &RetryConfig,
270269
) -> Result<Arc<AwsCredential>> {
271270
match self {
272-
CredentialProvider::Static { credential } => Ok(Arc::clone(&credential)),
271+
CredentialProvider::Static { credential } => Ok(Arc::clone(credential)),
273272
CredentialProvider::Instance { cache } => {
274273
cache
275274
.get_or_insert_with(|| {

object_store/src/aws/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl ObjectStore for AmazonS3 {
195195
.context(MissingContentLengthSnafu)?;
196196

197197
let last_modified = last_modified.to_str().context(BadHeaderSnafu)?;
198-
let last_modified = DateTime::parse_from_rfc2822(last_modified.as_ref())
198+
let last_modified = DateTime::parse_from_rfc2822(last_modified)
199199
.context(InvalidLastModifiedSnafu { last_modified })?
200200
.with_timezone(&Utc);
201201

@@ -325,7 +325,7 @@ impl CloudMultiPartUploadImpl for S3MultiPartUpload {
325325
/// .with_secret_access_key(SECRET_KEY)
326326
/// .build();
327327
/// ```
328-
#[derive(Debug)]
328+
#[derive(Debug, Default)]
329329
pub struct AmazonS3Builder {
330330
access_key_id: Option<String>,
331331
secret_access_key: Option<String>,
@@ -337,21 +337,6 @@ pub struct AmazonS3Builder {
337337
allow_http: bool,
338338
}
339339

340-
impl Default for AmazonS3Builder {
341-
fn default() -> Self {
342-
Self {
343-
access_key_id: None,
344-
secret_access_key: None,
345-
region: None,
346-
bucket_name: None,
347-
endpoint: None,
348-
token: None,
349-
retry_config: Default::default(),
350-
allow_http: false,
351-
}
352-
}
353-
}
354-
355340
impl AmazonS3Builder {
356341
/// Create a new [`AmazonS3Builder`] with default values.
357342
pub fn new() -> Self {

object_store/src/client/pagination.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
};
4747

4848
let next_state = match continuation {
49-
Some(token) => ListState::HasMore(s, token.clone()),
49+
Some(token) => ListState::HasMore(s, token),
5050
None => ListState::Done,
5151
};
5252

0 commit comments

Comments
 (0)