refactor: 补全 Default trait + 简化 Rust 2021 惯用写法
- LinuxArm64Backend: 添加 Default impl(与其他插件保持一致) - version_manager.rs: [active, stable].into_iter() 替换 IntoIterator::into_iter() (Rust 2021 edition 原生支持数组 IntoIterator)
This commit is contained in:
@@ -127,7 +127,8 @@ impl VersionManager {
|
|||||||
|
|
||||||
let active = entry.map(|e| e.active_version.as_str());
|
let active = entry.map(|e| e.active_version.as_str());
|
||||||
let stable = entry.and_then(|e| e.last_stable_version.as_deref());
|
let stable = entry.and_then(|e| e.last_stable_version.as_deref());
|
||||||
let protected_count = IntoIterator::into_iter([active, stable])
|
let protected_count = [active, stable]
|
||||||
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect::<HashSet<_>>()
|
.collect::<HashSet<_>>()
|
||||||
.len();
|
.len();
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ pub struct LinuxArm64Backend {
|
|||||||
backlight_enabled: bool,
|
backlight_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for LinuxArm64Backend {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl LinuxArm64Backend {
|
impl LinuxArm64Backend {
|
||||||
/// 创建新的 Linux ARM64 后端实例
|
/// 创建新的 Linux ARM64 后端实例
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user