Skip to content

Commit 4dbde8c

Browse files
committed
Use seek!(...); instead of seek! { ... } to enable rustfmt
see https://users.rust-lang.org/t/rustfmt-skips-macro-arguments/74807/4
1 parent 59a3d4d commit 4dbde8c

File tree

3 files changed

+56
-18
lines changed

3 files changed

+56
-18
lines changed

src/controllers/helpers/pagination.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,22 @@ mod tests {
608608

609609
mod seek {
610610
use chrono::naive::serde::ts_microseconds;
611-
seek! {
611+
seek!(
612612
pub(super) enum Seek {
613-
Id{id: i32},
614-
New{#[serde(with="ts_microseconds")] dt: chrono::NaiveDateTime, id: i32},
615-
RecentDownloads{ downloads: Option<i64>, id: i32 },
613+
Id {
614+
id: i32,
615+
},
616+
New {
617+
#[serde(with = "ts_microseconds")]
618+
dt: chrono::NaiveDateTime,
619+
id: i32,
620+
},
621+
RecentDownloads {
622+
downloads: Option<i64>,
623+
id: i32,
624+
},
616625
}
617-
}
626+
);
618627
}
619628

620629
#[test]

src/controllers/krate/search.rs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,40 @@ mod seek {
558558
use crate::models::Crate;
559559
use chrono::naive::serde::ts_microseconds;
560560

561-
seek! {
561+
seek!(
562562
pub enum Seek {
563-
Name{ id: i32 },
564-
New{#[serde(with="ts_microseconds")] created_at: chrono::NaiveDateTime, id: i32},
565-
RecentUpdates{#[serde(with="ts_microseconds")] updated_at: chrono::NaiveDateTime, id: i32},
566-
RecentDownloads{recent_downloads: Option<i64>, id: i32},
567-
Downloads{downloads: i64, id: i32},
568-
Query{exact_match: bool, id: i32},
569-
Relevance{exact_match: bool, rank: f32, id: i32},
563+
Name {
564+
id: i32,
565+
},
566+
New {
567+
#[serde(with = "ts_microseconds")]
568+
created_at: chrono::NaiveDateTime,
569+
id: i32,
570+
},
571+
RecentUpdates {
572+
#[serde(with = "ts_microseconds")]
573+
updated_at: chrono::NaiveDateTime,
574+
id: i32,
575+
},
576+
RecentDownloads {
577+
recent_downloads: Option<i64>,
578+
id: i32,
579+
},
580+
Downloads {
581+
downloads: i64,
582+
id: i32,
583+
},
584+
Query {
585+
exact_match: bool,
586+
id: i32,
587+
},
588+
Relevance {
589+
exact_match: bool,
590+
rank: f32,
591+
id: i32,
592+
},
570593
}
571-
}
594+
);
572595

573596
impl Seek {
574597
pub(crate) fn to_payload(

src/controllers/krate/versions.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,18 @@ mod seek {
234234
// We might consider refactoring this to use named fields, which would be clearer and more
235235
// flexible. It's also worth noting that we currently encode seek compactly as a Vec, which
236236
// doesn't include field names.
237-
seek! {
237+
seek!(
238238
pub enum Seek {
239-
Semver{id: i32},
240-
Date{#[serde(with="ts_microseconds")] created_at: chrono::NaiveDateTime, id: i32},
239+
Semver {
240+
id: i32,
241+
},
242+
Date {
243+
#[serde(with = "ts_microseconds")]
244+
created_at: chrono::NaiveDateTime,
245+
id: i32,
246+
},
241247
}
242-
}
248+
);
243249

244250
impl Seek {
245251
pub(crate) fn to_payload(&self, record: &(Version, Option<User>)) -> SeekPayload {

0 commit comments

Comments
 (0)