From 8128f2c94313b2e9b9d0b5c3350623f77bbb2521 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 2 Jul 2026 04:22:30 +0800 Subject: chore: run cargo fmt and rearrange re-exports in mingling --- mling/src/errors/io_error.rs | 5 ++++- mling/src/pkg_mgr/installer.rs | 1 + mling/src/proj_mgr/checklist_reader.rs | 35 +++++++++++++++++----------------- 3 files changed, 23 insertions(+), 18 deletions(-) (limited to 'mling') diff --git a/mling/src/errors/io_error.rs b/mling/src/errors/io_error.rs index 9f93ad7..92a3951 100644 --- a/mling/src/errors/io_error.rs +++ b/mling/src/errors/io_error.rs @@ -1,4 +1,7 @@ -use mingling::{macros::{group, r_println, renderer}, res::ResExitCode}; +use mingling::{ + macros::{group, r_println, renderer}, + res::ResExitCode, +}; use crate::eformat_cargo; diff --git a/mling/src/pkg_mgr/installer.rs b/mling/src/pkg_mgr/installer.rs index e69de29..8b13789 100644 --- a/mling/src/pkg_mgr/installer.rs +++ b/mling/src/pkg_mgr/installer.rs @@ -0,0 +1 @@ + diff --git a/mling/src/proj_mgr/checklist_reader.rs b/mling/src/proj_mgr/checklist_reader.rs index 6d115bb..558d303 100644 --- a/mling/src/proj_mgr/checklist_reader.rs +++ b/mling/src/proj_mgr/checklist_reader.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, path::Path, io}; +use std::{collections::HashMap, io, path::Path}; /// Reads and parses a `CHECKLIST.md` file, extracting both *values* (from /// fenced code blocks) and *toggles* (from checkbox lines). @@ -56,27 +56,28 @@ impl CheckListReader { let line = lines[i]; if let Some(key) = line.strip_prefix("```").map(|s| s.trim()) - && !key.is_empty() && !key.starts_with(' ') { - let mut block_lines = Vec::new(); + && !key.is_empty() + && !key.starts_with(' ') + { + let mut block_lines = Vec::new(); + i += 1; + while i < lines.len() && !lines[i].trim_start().starts_with("```") { + block_lines.push(lines[i]); i += 1; - while i < lines.len() && !lines[i].trim_start().starts_with("```") { - block_lines.push(lines[i]); - i += 1; - } - let value = block_lines - .into_iter() - .find(|l| !l.trim().is_empty()) - .map(|l| l.trim().to_string()); - if let Some(val) = value { - self.values.insert(key.to_string(), val); - } - continue; } + let value = block_lines + .into_iter() + .find(|l| !l.trim().is_empty()) + .map(|l| l.trim().to_string()); + if let Some(val) = value { + self.values.insert(key.to_string(), val); + } + continue; + } if let Some(toggle_key) = Self::parse_toggle_line(line) { let is_checked = line.contains("[x]") || line.contains("[X]"); - self.all_toggles - .insert(toggle_key.clone(), is_checked); + self.all_toggles.insert(toggle_key.clone(), is_checked); if is_checked { self.toggles.insert(toggle_key, true); } -- cgit