From 72c1c1564af042d2b5472507104c3a67aa36b262 Mon Sep 17 00:00:00 2001 From: Wei Date: Mon, 19 Sep 2022 18:13:42 +0800 Subject: [PATCH] add error handling for default case --- AutoBuild/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/AutoBuild/main.rs b/AutoBuild/main.rs index 735af3c..61a55e3 100644 --- a/AutoBuild/main.rs +++ b/AutoBuild/main.rs @@ -59,10 +59,9 @@ fn main() { let mut name: Vec<&str> = text.split(".").collect(); let name = name[0]; - let mut output = String::from(""); - match category.0.as_str() { + let output = match category.0.as_str() { "hosts" => { - output = format!( + format!( "! FutaHosts\n\ ! LowTechFilter {name}\n\ ! URL: \n\ @@ -73,7 +72,7 @@ fn main() { ) } "abp" => { - output = format!( + format!( "[Adblock Plus]\n\ ! Title: LowTechFilter {name}\n\ ! Version: {version}\n\ @@ -84,7 +83,9 @@ fn main() { version = newversion ) } - _ => {} + _ => { + continue; + } }; // open and ready to write