Utilize `if let` construct over single branch `match`.
authorCorey Farwell <coreyf@rwell.org>
Tue, 3 May 2016 01:18:14 +0000 (21:18 -0400)
committerCorey Farwell <coreyf@rwell.org>
Tue, 3 May 2016 01:18:14 +0000 (21:18 -0400)
src/cargo/util/toml.rs

index 288aa2be59a539d84ced55b688990f932fb058fa..5e0d3868e39c306faf2a0906a1a3345cb284a446 100644 (file)
@@ -156,9 +156,8 @@ pub fn to_manifest(contents: &[u8],
 
 pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::Table> {
     let mut parser = toml::Parser::new(&toml);
-    match parser.parse() {
-        Some(toml) => return Ok(toml),
-        None => {}
+    if let Some(toml) = parser.parse() {
+        return Ok(toml);
     }
     let mut error_str = format!("could not parse input as TOML\n");
     for error in parser.errors.iter() {