Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Oct 24, 2023
1 parent 2f19c55 commit 7617bad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions object_store/src/client/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! Logic for extracting ObjectMeta from headers used by AWS, GCP and Azure

use crate::path::Path;
use crate::{ObjectMeta, PutResult};
use crate::ObjectMeta;
use chrono::{DateTime, TimeZone, Utc};
use hyper::header::{CONTENT_LENGTH, ETAG, LAST_MODIFIED};
use hyper::HeaderMap;
Expand Down Expand Up @@ -67,14 +67,16 @@ pub enum Error {
},
}

/// Extracts a [`PutResult`] from the provided [`HeaderMap`]
pub fn get_put_result(headers: &HeaderMap, version: &str) -> Result<PutResult, Error> {
/// Extracts a PutResult from the provided [`HeaderMap`]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
pub fn get_put_result(headers: &HeaderMap, version: &str) -> Result<crate::PutResult, Error> {
let e_tag = Some(get_etag(headers)?);
let version = get_version(headers, version)?;
Ok(PutResult { e_tag, version })
Ok(crate::PutResult { e_tag, version })
}

/// Extracts a optional version from the provided [`HeaderMap`]
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
pub fn get_version(headers: &HeaderMap, version: &str) -> Result<Option<String>, Error> {
Ok(match headers.get(version) {
Some(x) => Some(x.to_str().context(BadHeaderSnafu)?.to_string()),
Expand Down

0 comments on commit 7617bad

Please sign in to comment.