mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Use entry API instead of a match
This makes the code easier to read and also avoids looking up the position in the map twice. The clone of `unit` is very cheap since it is an Rc.
This commit is contained in:
parent
0a975e96d8
commit
1d1b344781
@ -475,13 +475,11 @@ pub fn create_bcx<'a, 'cfg>(
|
||||
extra_args = Some(args);
|
||||
}
|
||||
|
||||
if let Some(mut args) = extra_args {
|
||||
match extra_compiler_args.get_mut(&unit) {
|
||||
None => {
|
||||
extra_compiler_args.insert(unit.clone(), args);
|
||||
}
|
||||
Some(existing) => existing.append(&mut args),
|
||||
}
|
||||
if let Some(args) = extra_args {
|
||||
extra_compiler_args
|
||||
.entry(unit.clone())
|
||||
.or_default()
|
||||
.extend(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user