Skip to content

Commit 51a56a4

Browse files
committed
format crates-io and cargo-test-macro subcrates
1 parent cbc4589 commit 51a56a4

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

crates/cargo-test-macro/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extern crate proc_macro;
22

33
use quote::{quote, ToTokens};
4-
use syn::{*, parse::Parser};
4+
use syn::{parse::Parser, *};
55

66
#[proc_macro_attribute]
77
pub fn cargo_test(
@@ -13,7 +13,9 @@ pub fn cargo_test(
1313
let attr = quote! {
1414
#[test]
1515
};
16-
fn_def.attrs.extend(Attribute::parse_outer.parse2(attr).unwrap());
16+
fn_def
17+
.attrs
18+
.extend(Attribute::parse_outer.parse2(attr).unwrap());
1719

1820
let stmt = quote! {
1921
let _test_guard = crate::support::paths::init_root();

crates/crates-io/lib.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ impl Registry {
185185
(json.len() >> 8) as u8,
186186
(json.len() >> 16) as u8,
187187
(json.len() >> 24) as u8,
188-
].iter().cloned(),
188+
]
189+
.iter()
190+
.cloned(),
189191
);
190192
w.extend(json.as_bytes().iter().cloned());
191193
w.extend(
@@ -194,7 +196,9 @@ impl Registry {
194196
(stat.len() >> 8) as u8,
195197
(stat.len() >> 16) as u8,
196198
(stat.len() >> 24) as u8,
197-
].iter().cloned(),
199+
]
200+
.iter()
201+
.cloned(),
198202
);
199203
w
200204
};
@@ -337,17 +341,17 @@ impl Registry {
337341
Ok(body) => body,
338342
Err(..) => bail!("response body was not valid utf-8"),
339343
};
340-
let errors = serde_json::from_str::<ApiErrorList>(&body).ok().map(|s| {
341-
s.errors.into_iter().map(|s| s.detail).collect::<Vec<_>>()
342-
});
344+
let errors = serde_json::from_str::<ApiErrorList>(&body)
345+
.ok()
346+
.map(|s| s.errors.into_iter().map(|s| s.detail).collect::<Vec<_>>());
343347

344348
match (self.handle.response_code()?, errors) {
345-
(0, None) | (200, None) => {},
346-
(503, None) if started.elapsed().as_secs() >= 29 && self.host_is_crates_io() => {
347-
bail!("Request timed out after 30 seconds. If you're trying to \
348-
upload a crate it may be too large. If the crate is under \
349-
10MB in size, you can email [email protected] for assistance.")
350-
}
349+
(0, None) | (200, None) => {}
350+
(503, None) if started.elapsed().as_secs() >= 29 && self.host_is_crates_io() => bail!(
351+
"Request timed out after 30 seconds. If you're trying to \
352+
upload a crate it may be too large. If the crate is under \
353+
10MB in size, you can email [email protected] for assistance."
354+
),
351355
(code, Some(errors)) => {
352356
let code = StatusCode::from_u16(code as _)?;
353357
bail!("api errors (status {}): {}", code, errors.join(", "))
@@ -358,9 +362,9 @@ impl Registry {
358362
\t{}\n\
359363
body:\n\
360364
{}",
361-
code,
362-
headers.join("\n\t"),
363-
body,
365+
code,
366+
headers.join("\n\t"),
367+
body,
364368
),
365369
}
366370

0 commit comments

Comments
 (0)