allow option_if_let_else

This commit is contained in:
galister
2025-11-30 11:42:34 +09:00
parent 7d581c1561
commit 363c2d533c
3 changed files with 11 additions and 11 deletions

View File

@@ -14,7 +14,8 @@
clippy::needless_pass_by_value,
clippy::needless_pass_by_ref_mut,
clippy::multiple_crate_versions,
clippy::cargo_common_metadata
clippy::cargo_common_metadata,
clippy::option_if_let_else
)]
mod backend;
mod config;
@@ -33,8 +34,8 @@ mod config_wayvr;
use std::{
path::PathBuf,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
Arc,
},
};
@@ -42,7 +43,7 @@ use clap::Parser;
use subsystem::notifications::DbusNotificationSender;
use sysinfo::Pid;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
/// The lightweight desktop overlay for OpenVR and OpenXR
#[derive(Default, Parser, Debug)]
@@ -137,7 +138,7 @@ fn auto_run(running: Arc<AtomicBool>, args: Args) {
#[cfg(feature = "openxr")]
if !args_get_openvr(&args) {
use crate::backend::{BackendError, openxr::openxr_run};
use crate::backend::{openxr::openxr_run, BackendError};
tried_xr = true;
match openxr_run(running.clone(), args.show, args.headless) {
Ok(()) => return,
@@ -151,7 +152,7 @@ fn auto_run(running: Arc<AtomicBool>, args: Args) {
#[cfg(feature = "openvr")]
if !args_get_openxr(&args) {
use crate::backend::{BackendError, openvr::openvr_run};
use crate::backend::{openvr::openvr_run, BackendError};
tried_vr = true;
match openvr_run(running, args.show, args.headless) {
Ok(()) => return,

View File

@@ -19,16 +19,16 @@ use wlx_common::windowing::{OverlayWindowState, Positioning};
use crate::{
backend::task::{ManagerTask, TaskType},
gui::{
panel::{GuiPanel, NewGuiPanelParams, OnCustomAttribFunc, button::BUTTON_EVENTS},
panel::{button::BUTTON_EVENTS, GuiPanel, NewGuiPanelParams, OnCustomAttribFunc},
timer::GuiTimer,
},
overlays::edit::LongPressButtonState,
state::AppState,
windowing::{
OverlaySelector, Z_ORDER_WATCH,
backend::{OverlayEventData, OverlayMeta},
manager::MAX_OVERLAY_SETS,
window::{OverlayWindowConfig, OverlayWindowData},
OverlaySelector, Z_ORDER_WATCH,
},
};
@@ -215,9 +215,7 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
}
OverlayEventData::OverlaysChanged(metas) => {
panel.state.overlay_metas = metas;
// FIXME: should we suppress this clippy warning in the crate itself? the resulting code isn't always more readable than before
for (idx, btn) in panel.state.overlay_buttons.iter().enumerate() {
#[allow(clippy::option_if_let_else)]
let display = if let Some(meta) = panel.state.overlay_metas.get(idx) {
btn.set_text(&mut common, Translation::from_raw_text(&meta.name));
//TODO: add category icons

View File

@@ -7,8 +7,8 @@ use vulkano::{
image::view::ImageView,
};
use wgui::gfx::{
WGfx,
cmd::{GfxCommandBuffer, WGfxClearMode},
WGfx,
};
use crate::{
@@ -16,7 +16,7 @@ use crate::{
graphics::ExtentExt,
state::AppState,
subsystem::hid::WheelDelta,
windowing::{OverlayID, window::OverlayCategory},
windowing::{window::OverlayCategory, OverlayID},
};
#[derive(Default, Clone, Copy)]
@@ -77,6 +77,7 @@ pub enum OverlayEventData {
NumSetsChanged(usize),
EditModeChanged(bool),
OverlaysChanged(Vec<OverlayMeta>),
DevicesChanged,
}
pub trait OverlayBackend: Any {