Replace uses of try!() macro with "?" operator

This commit is contained in:
Matthias Beyer 2017-10-30 20:19:29 +01:00
parent d5f537dc4d
commit ee7b04dd42

View file

@ -254,12 +254,12 @@ fn main() {
} }
fn fetch_aliases(rt: &Runtime) -> Result<BTreeMap<String, String>, String> { fn fetch_aliases(rt: &Runtime) -> Result<BTreeMap<String, String>, String> {
let cfg = try!(rt.config().ok_or_else(|| String::from("No configuration found"))); let cfg = rt.config().ok_or_else(|| String::from("No configuration found"))?;
let value = cfg let value = cfg
.read("imag.aliases") .read("imag.aliases")
.map_err(|_| String::from("Reading from config failed")); .map_err(|_| String::from("Reading from config failed"));
match try!(value) { match value? {
None => Ok(BTreeMap::new()), None => Ok(BTreeMap::new()),
Some(&Value::Table(ref tbl)) => { Some(&Value::Table(ref tbl)) => {
let mut alias_mappings = BTreeMap::new(); let mut alias_mappings = BTreeMap::new();