Use or_else() instead of or()

This commit is contained in:
Matthias Beyer 2018-04-24 20:58:02 +02:00
parent 775508a6ed
commit 42c4186dec

View file

@ -75,7 +75,12 @@ impl IntoKeyValue<String, String> for String {
.unwrap(); .unwrap();
} }
R.captures(&self[..]) R.captures(&self[..])
.map(|c| c.name("VALUE").or(c.name("QVALUE")).map(|m| m.as_str()).unwrap_or("")) .map(|c| {
c.name("VALUE")
.or_else(|| c.name("QVALUE"))
.map(|m| m.as_str())
.unwrap_or("")
})
}; };
key.and_then(|k| { key.and_then(|k| {