From 3e0befb7301cfdbae78cef2979726e8dda17e641 Mon Sep 17 00:00:00 2001 From: soul <104170577@qq.com> Date: Sat, 24 Feb 2024 18:13:29 +0800 Subject: [PATCH] refactor: use break-label to break nested loop --- src-tauri/src/services/category.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/services/category.rs b/src-tauri/src/services/category.rs index aee19d3..37f7e72 100644 --- a/src-tauri/src/services/category.rs +++ b/src-tauri/src/services/category.rs @@ -105,19 +105,12 @@ fn filter_new_interfaces( let config_json = config.read_config().unwrap(); let mut config_interfaces = vec![]; - let mut find_config_interfaces = false; - for project in config_json.project_list { - if find_config_interfaces == true { - break; - } + 'project: for project in config_json.project_list { for category in project.categories { - if find_config_interfaces == true { - break; - } if category.id == category_id { config_interfaces = category.interfaces; - find_config_interfaces = true; + break 'project; } } }