Simplifies a few pattern-matches

... which have a direct combinator equivalent on Option / Result.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).
This commit is contained in:
François Garillot
2021-03-23 05:56:23 -07:00
parent 01b8bafa9c
commit b832de05df
5 changed files with 14 additions and 27 deletions

View File

@ -57,10 +57,7 @@ impl SymbolRegistry for ShortNames {
return None;
}
let (ty, idx) = name.split_at(1);
let idx = match idx.parse::<u32>() {
Ok(v) => v,
Err(_) => return None,
};
let idx = idx.parse::<u32>().ok()?;
match ty.chars().next().unwrap() {
'f' => Some(Symbol::LocalFunction(LocalFunctionIndex::from_u32(idx))),
's' => Some(Symbol::Section(SectionIndex::from_u32(idx))),