Skip to content

Commit

Permalink
cargo +stable fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Jul 8, 2018
1 parent 3b495a5 commit d0d9377
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/cargo/sources/registry/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,20 @@ impl<'cfg> RegistryIndex<'cfg> {
// This loop tries all possible combinations of
// hyphen and underscores to find the uncanonicalized one.
for hyphen_combination_num in 0u16..(1 << num_hyphen_underscore) {
let path = raw_path.chars()
.scan(0u32, |s, c| if c == '_' || c == '-' {
let out = Some(if (hyphen_combination_num & (1u16 << *s)) > 0 { '_' } else { '-' });
*s += 1;
out
} else {
Some(c)
let path = raw_path
.chars()
.scan(0u32, |s, c| {
if c == '_' || c == '-' {
let out = Some(if (hyphen_combination_num & (1u16 << *s)) > 0 {
'_'
} else {
'-'
});
*s += 1;
out
} else {
Some(c)
}
})
.collect::<String>();
let mut hit_closure = false;
Expand Down

0 comments on commit d0d9377

Please sign in to comment.