diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-10 15:49:31 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-10 15:49:31 +0800 |
| commit | a9d5943939261e27e58bcf5cacbb618a0f63e999 (patch) | |
| tree | d1cacc2af939e993f2d7d2794500e6456659e6a9 /mingling_core/src/program/string_vec.rs | |
| parent | 782d2458dc4ad4336e1407e1f107e43e39b0b991 (diff) | |
refactor(core): improve code style and public API clarity
Replace bool-based settings with enums, refine visibility and
signatures, and standardize `Self` usage across the crate.
- Introduce `ErrorOutput`, `RenderOutput`, `PanicSilence`, `Verbosity`,
`ColorOutput`, and `ProgressOutput` enums for clearer configuration
semantics
- Make `GlobalResources`, `ProgramCell`, and
`split_input`/`split_input_string` public
- Change hook info parameters to accept references and
`split_input_string` to take `&str`
- Apply `Self` shorthand throughout implementations and add
`#[must_use]` attributes where appropriate
- Enable strict clippy lints with targeted allowances
Diffstat (limited to 'mingling_core/src/program/string_vec.rs')
| -rw-r--r-- | mingling_core/src/program/string_vec.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mingling_core/src/program/string_vec.rs b/mingling_core/src/program/string_vec.rs index c2e6220..a2eb433 100644 --- a/mingling_core/src/program/string_vec.rs +++ b/mingling_core/src/program/string_vec.rs @@ -20,7 +20,7 @@ impl From<StringVec> for Vec<String> { impl<const N: usize> From<[&str; N]> for StringVec { fn from(slice: [&str; N]) -> Self { - StringVec { + Self { vec: slice.iter().map(|&s| s.to_string()).collect(), } } @@ -28,21 +28,20 @@ impl<const N: usize> From<[&str; N]> for StringVec { impl From<&[&str]> for StringVec { fn from(slice: &[&str]) -> Self { - StringVec { + Self { vec: slice.iter().map(|&s| s.to_string()).collect(), } } } - impl From<Vec<String>> for StringVec { fn from(vec: Vec<String>) -> Self { - StringVec { vec } + Self { vec } } } impl From<&[String]> for StringVec { fn from(slice: &[String]) -> Self { - StringVec { + Self { vec: slice.to_vec(), } } @@ -50,7 +49,7 @@ impl From<&[String]> for StringVec { impl From<Vec<&str>> for StringVec { fn from(vec: Vec<&str>) -> Self { - StringVec { + Self { vec: vec.iter().map(|&s| s.to_string()).collect(), } } |
