diff --git a/crates/cargo-test-macro/src/lib.rs b/crates/cargo-test-macro/src/lib.rs index 3a4b736bc23..badc3f08233 100644 --- a/crates/cargo-test-macro/src/lib.rs +++ b/crates/cargo-test-macro/src/lib.rs @@ -1,7 +1,7 @@ extern crate proc_macro; use quote::{quote, ToTokens}; -use syn::{*, parse::Parser}; +use syn::{parse::Parser, *}; #[proc_macro_attribute] pub fn cargo_test( @@ -13,7 +13,9 @@ pub fn cargo_test( let attr = quote! { #[test] }; - fn_def.attrs.extend(Attribute::parse_outer.parse2(attr).unwrap()); + fn_def + .attrs + .extend(Attribute::parse_outer.parse2(attr).unwrap()); let stmt = quote! { let _test_guard = crate::support::paths::init_root(); diff --git a/crates/crates-io/lib.rs b/crates/crates-io/lib.rs index 941b0d75a92..913b61f7a6d 100644 --- a/crates/crates-io/lib.rs +++ b/crates/crates-io/lib.rs @@ -185,7 +185,9 @@ impl Registry { (json.len() >> 8) as u8, (json.len() >> 16) as u8, (json.len() >> 24) as u8, - ].iter().cloned(), + ] + .iter() + .cloned(), ); w.extend(json.as_bytes().iter().cloned()); w.extend( @@ -194,7 +196,9 @@ impl Registry { (stat.len() >> 8) as u8, (stat.len() >> 16) as u8, (stat.len() >> 24) as u8, - ].iter().cloned(), + ] + .iter() + .cloned(), ); w }; @@ -337,17 +341,17 @@ impl Registry { Ok(body) => body, Err(..) => bail!("response body was not valid utf-8"), }; - let errors = serde_json::from_str::(&body).ok().map(|s| { - s.errors.into_iter().map(|s| s.detail).collect::>() - }); + let errors = serde_json::from_str::(&body) + .ok() + .map(|s| s.errors.into_iter().map(|s| s.detail).collect::>()); match (self.handle.response_code()?, errors) { - (0, None) | (200, None) => {}, - (503, None) if started.elapsed().as_secs() >= 29 && self.host_is_crates_io() => { - bail!("Request timed out after 30 seconds. If you're trying to \ - upload a crate it may be too large. If the crate is under \ - 10MB in size, you can email help@crates.io for assistance.") - } + (0, None) | (200, None) => {} + (503, None) if started.elapsed().as_secs() >= 29 && self.host_is_crates_io() => bail!( + "Request timed out after 30 seconds. If you're trying to \ + upload a crate it may be too large. If the crate is under \ + 10MB in size, you can email help@crates.io for assistance." + ), (code, Some(errors)) => { let code = StatusCode::from_u16(code as _)?; bail!("api errors (status {}): {}", code, errors.join(", ")) @@ -358,9 +362,9 @@ impl Registry { \t{}\n\ body:\n\ {}", - code, - headers.join("\n\t"), - body, + code, + headers.join("\n\t"), + body, ), }