fix compilation warnings #959
7 changed files with 14 additions and 17 deletions
4
Makefile
4
Makefile
|
@ -2,9 +2,7 @@
|
|||
|
||||
all:
|
||||
clear
|
||||
cargo build \
|
||||
--config 'target.x86_64-unknown-linux-gnu.linker="clang"' \
|
||||
--config 'target.x86_64-unknown-linux-gnu.rustflags=["-C", "link-arg=-fuse-ld=mold"]' \
|
||||
cargo build
|
||||
|
||||
# ----
|
||||
|
||||
|
|
|
@ -317,7 +317,6 @@ impl ApiHandler for S3ApiServer {
|
|||
} => {
|
||||
let query = ListPartsQuery {
|
||||
bucket_name: ctx.bucket_name.clone(),
|
||||
bucket_id,
|
||||
key,
|
||||
upload_id,
|
||||
part_number_marker: part_number_marker.map(|p| p.min(10000)),
|
||||
|
|
|
@ -54,7 +54,6 @@ pub struct ListMultipartUploadsQuery {
|
|||
#[derive(Debug)]
|
||||
pub struct ListPartsQuery {
|
||||
pub bucket_name: String,
|
||||
pub bucket_id: Uuid,
|
||||
pub key: String,
|
||||
pub upload_id: String,
|
||||
pub part_number_marker: Option<u64>,
|
||||
|
@ -1245,10 +1244,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_part_info() -> Result<(), Error> {
|
||||
let uuid = Uuid::from([0x08; 32]);
|
||||
let mut query = ListPartsQuery {
|
||||
bucket_name: "a".to_string(),
|
||||
bucket_id: uuid,
|
||||
key: "a".to_string(),
|
||||
upload_id: "xx".to_string(),
|
||||
part_number_marker: None,
|
||||
|
|
|
@ -13,7 +13,6 @@ static GARAGE_TEST_SECRET: &str =
|
|||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Key {
|
||||
pub name: Option<String>,
|
||||
pub id: String,
|
||||
pub secret: String,
|
||||
}
|
||||
|
@ -213,10 +212,7 @@ api_bind_addr = "127.0.0.1:{admin_port}"
|
|||
assert!(!key.id.is_empty(), "Invalid key: Key ID is empty");
|
||||
assert!(!key.secret.is_empty(), "Invalid key: Key secret is empty");
|
||||
|
||||
Key {
|
||||
name: maybe_name.map(String::from),
|
||||
..key
|
||||
}
|
||||
key
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ impl Garage {
|
|||
|
||||
pub async fn locked_helper(&self) -> helper::locked::LockedHelper {
|
||||
let lock = self.bucket_lock.lock().await;
|
||||
helper::locked::LockedHelper(self, lock)
|
||||
helper::locked::LockedHelper(self, Some(lock))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,16 @@ use crate::permission::BucketKeyPerm;
|
|||
/// See issues: #649, #723
|
||||
pub struct LockedHelper<'a>(
|
||||
pub(crate) &'a Garage,
|
||||
pub(crate) tokio::sync::MutexGuard<'a, ()>,
|
||||
pub(crate) Option<tokio::sync::MutexGuard<'a, ()>>,
|
||||
);
|
||||
|
||||
impl<'a> Drop for LockedHelper<'a> {
|
||||
fn drop(&mut self) {
|
||||
// make it explicit that the mutexguard lives until here
|
||||
drop(self.1.take())
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::ptr_arg)]
|
||||
impl<'a> LockedHelper<'a> {
|
||||
pub fn bucket(&self) -> BucketHelper<'a> {
|
||||
|
|
|
@ -395,13 +395,13 @@ fn midnight_ts(date: NaiveDate, use_local_tz: bool) -> u64 {
|
|||
.expect("bad local midnight")
|
||||
.timestamp_millis() as u64;
|
||||
}
|
||||
midnight.timestamp_millis() as u64
|
||||
midnight.and_utc().timestamp_millis() as u64
|
||||
}
|
||||
|
||||
fn next_date(ts: u64) -> NaiveDate {
|
||||
NaiveDateTime::from_timestamp_millis(ts as i64)
|
||||
DateTime::<Utc>::from_timestamp_millis(ts as i64)
|
||||
.expect("bad timestamp")
|
||||
.date()
|
||||
.date_naive()
|
||||
.succ_opt()
|
||||
.expect("no next day")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue