File tree 6 files changed +45
-21
lines changed
crates/xtask-stale-label/src
6 files changed +45
-21
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
34
34
35
35
for ( label, value) in autolabel. iter ( ) {
36
36
let Some ( trigger_files) = value. get ( "trigger_files" ) else {
37
- continue
37
+ continue ;
38
38
} ;
39
39
let trigger_files = trigger_files. as_array ( ) . expect ( "an array" ) ;
40
40
let missing_files: Vec < _ > = trigger_files
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ pub fn certificate_check(
141
141
let Some ( host_key) = cert. as_hostkey ( ) else {
142
142
// Return passthrough for TLS X509 certificates to use whatever validation
143
143
// was done in git2.
144
- return Ok ( CertificateCheckStatus :: CertificatePassthrough )
144
+ return Ok ( CertificateCheckStatus :: CertificatePassthrough ) ;
145
145
} ;
146
146
// If a nonstandard port is in use, check for that first.
147
147
// The fallback to check without a port is handled in the HostKeyNotFound handler.
@@ -611,10 +611,18 @@ impl KnownHost {
611
611
}
612
612
613
613
fn hashed_hostname_matches ( host : & str , hashed : & str ) -> bool {
614
- let Some ( ( b64_salt, b64_host) ) = hashed. split_once ( '|' ) else { return false ; } ;
615
- let Ok ( salt) = STANDARD . decode ( b64_salt) else { return false ; } ;
616
- let Ok ( hashed_host) = STANDARD . decode ( b64_host) else { return false ; } ;
617
- let Ok ( mut mac) = hmac:: Hmac :: < sha1:: Sha1 > :: new_from_slice ( & salt) else { return false ; } ;
614
+ let Some ( ( b64_salt, b64_host) ) = hashed. split_once ( '|' ) else {
615
+ return false ;
616
+ } ;
617
+ let Ok ( salt) = STANDARD . decode ( b64_salt) else {
618
+ return false ;
619
+ } ;
620
+ let Ok ( hashed_host) = STANDARD . decode ( b64_host) else {
621
+ return false ;
622
+ } ;
623
+ let Ok ( mut mac) = hmac:: Hmac :: < sha1:: Sha1 > :: new_from_slice ( & salt) else {
624
+ return false ;
625
+ } ;
618
626
mac. update ( host. as_bytes ( ) ) ;
619
627
let result = mac. finalize ( ) . into_bytes ( ) ;
620
628
hashed_host == & result[ ..]
Original file line number Diff line number Diff line change @@ -808,7 +808,9 @@ impl<'cfg> Downloads<'cfg> {
808
808
/// Updates the state of the progress bar for downloads.
809
809
fn tick ( & self ) -> CargoResult < ( ) > {
810
810
let mut progress = self . progress . borrow_mut ( ) ;
811
- let Some ( progress) = progress. as_mut ( ) else { return Ok ( ( ) ) ; } ;
811
+ let Some ( progress) = progress. as_mut ( ) else {
812
+ return Ok ( ( ) ) ;
813
+ } ;
812
814
813
815
// Since the sparse protocol discovers dependencies as it goes,
814
816
// it's not possible to get an accurate progress indication.
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ pub fn public_token_from_credential(
73
73
source_id : & SourceId ,
74
74
mutation : Option < & ' _ Mutation < ' _ > > ,
75
75
) -> CargoResult < Secret < String > > {
76
- let RegistryCredentialConfig :: AsymmetricKey ( ( secret_key, secret_key_subject) ) = credential else {
76
+ let RegistryCredentialConfig :: AsymmetricKey ( ( secret_key, secret_key_subject) ) = credential
77
+ else {
77
78
anyhow:: bail!( "credential must be an asymmetric secret key" )
78
79
} ;
79
80
Original file line number Diff line number Diff line change @@ -207,7 +207,11 @@ impl DocFragment {
207
207
let syn:: Meta :: NameValue ( nv) = & attr. meta else {
208
208
anyhow:: bail!( "unsupported attr meta for {:?}" , attr. meta. path( ) )
209
209
} ;
210
- let syn:: Expr :: Lit ( syn:: ExprLit { lit : syn:: Lit :: Str ( lit) , .. } ) = & nv. value else {
210
+ let syn:: Expr :: Lit ( syn:: ExprLit {
211
+ lit : syn:: Lit :: Str ( lit) ,
212
+ ..
213
+ } ) = & nv. value
214
+ else {
211
215
anyhow:: bail!( "only string literals are supported" )
212
216
} ;
213
217
Ok ( Self {
@@ -373,16 +377,21 @@ fn unindent_doc_fragments(docs: &mut [DocFragment]) {
373
377
let Some ( min_indent) = docs
374
378
. iter ( )
375
379
. map ( |fragment| {
376
- fragment. doc . as_str ( ) . lines ( ) . fold ( usize:: MAX , |min_indent, line| {
377
- if line. chars ( ) . all ( |c| c. is_whitespace ( ) ) {
378
- min_indent
379
- } else {
380
- // Compare against either space or tab, ignoring whether they are
381
- // mixed or not.
382
- let whitespace = line. chars ( ) . take_while ( |c| * c == ' ' || * c == '\t' ) . count ( ) ;
383
- min_indent. min ( whitespace)
384
- }
385
- } )
380
+ fragment
381
+ . doc
382
+ . as_str ( )
383
+ . lines ( )
384
+ . fold ( usize:: MAX , |min_indent, line| {
385
+ if line. chars ( ) . all ( |c| c. is_whitespace ( ) ) {
386
+ min_indent
387
+ } else {
388
+ // Compare against either space or tab, ignoring whether they are
389
+ // mixed or not.
390
+ let whitespace =
391
+ line. chars ( ) . take_while ( |c| * c == ' ' || * c == '\t' ) . count ( ) ;
392
+ min_indent. min ( whitespace)
393
+ }
394
+ } )
386
395
} )
387
396
. min ( )
388
397
else {
Original file line number Diff line number Diff line change @@ -2835,7 +2835,9 @@ fn parse_unstable_lints<T: Deserialize<'static>>(
2835
2835
config : & Config ,
2836
2836
warnings : & mut Vec < String > ,
2837
2837
) -> CargoResult < Option < T > > {
2838
- let Some ( lints) = lints else { return Ok ( None ) ; } ;
2838
+ let Some ( lints) = lints else {
2839
+ return Ok ( None ) ;
2840
+ } ;
2839
2841
2840
2842
if !config. cli_unstable ( ) . lints {
2841
2843
warn_for_lint_feature ( config, warnings) ;
@@ -2878,7 +2880,9 @@ switch to nightly channel you can pass
2878
2880
}
2879
2881
2880
2882
fn verify_lints ( lints : Option < TomlLints > ) -> CargoResult < Option < TomlLints > > {
2881
- let Some ( lints) = lints else { return Ok ( None ) ; } ;
2883
+ let Some ( lints) = lints else {
2884
+ return Ok ( None ) ;
2885
+ } ;
2882
2886
2883
2887
for ( tool, lints) in & lints {
2884
2888
let supported = [ "rust" , "clippy" , "rustdoc" ] ;
You can’t perform that action at this time.
0 commit comments