mirror of
https://github.com/swc-project/swc.git
synced 2024-11-27 04:47:03 +03:00
refactor(es/preset-env): Avoid unnecessary unwrap
(#2943)
This commit is contained in:
parent
e8225a66a0
commit
3302d1733a
@ -455,14 +455,15 @@ impl BrowserData<Option<Version>> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let version = if version.contains("-") {
|
||||
version.split('-').next().unwrap().parse().unwrap()
|
||||
} else {
|
||||
version.parse().unwrap()
|
||||
};
|
||||
let version = version
|
||||
.split_once('-')
|
||||
.map(|(version, _)| version)
|
||||
.unwrap_or(version)
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
// lowest version
|
||||
if data[&browser].is_none() || data[&browser].unwrap() > version {
|
||||
if data[&browser].map(|v| v > version).unwrap_or(true) {
|
||||
for (k, v) in data.iter_mut() {
|
||||
if browser == k {
|
||||
*v = Some(version);
|
||||
|
Loading…
Reference in New Issue
Block a user