1
0
mirror of https://github.com/sharkdp/bat.git synced 2024-10-06 02:41:06 +01:00

Use 'or_insert_with'

This commit is contained in:
sharkdp 2020-06-03 10:08:41 +02:00 committed by David Peter
parent 74e8373e34
commit e57e9b6dbb

View File

@ -70,7 +70,7 @@ fn get_syntax_mapping_to_paths(
match mapping { match mapping {
(_, MappingTarget::MapToUnknown) => {} (_, MappingTarget::MapToUnknown) => {}
(matcher, MappingTarget::MapTo(s)) => { (matcher, MappingTarget::MapTo(s)) => {
let globs = map.entry((*s).into()).or_insert(Vec::new()); let globs = map.entry((*s).into()).or_insert_with(Vec::new);
globs.push(matcher.glob().glob().into()); globs.push(matcher.glob().glob().into());
} }
} }