refactor: pedantic cargo clippy, do not use Results for always-succeeding functions

This commit is contained in:
Aleksander
2025-08-16 21:27:47 +02:00
parent 1f8960033c
commit 481db7f23c
45 changed files with 320 additions and 310 deletions

View File

@@ -51,8 +51,8 @@ pub(super) struct LinePool {
impl LinePool {
pub(super) fn new(app: &AppState) -> anyhow::Result<Self> {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("frag_color").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_color").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,

View File

@@ -15,13 +15,13 @@ use vulkano::{
use crate::{
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
config_io,
graphics::{dds::WlxCommandBufferDds, CommandBuffers, ExtentExt},
graphics::{CommandBuffers, ExtentExt, dds::WlxCommandBufferDds},
state::AppState,
};
use super::{
swapchain::{create_swapchain, WlxSwapchain},
CompositionLayer, XrState,
swapchain::{WlxSwapchain, create_swapchain},
};
pub(super) struct Skybox {
@@ -96,8 +96,8 @@ impl Skybox {
let mut swapchain = create_swapchain(xr, app.gfx.clone(), extent, opts)?;
let tgt = swapchain.acquire_wait_image()?;
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,
@@ -145,8 +145,8 @@ impl Skybox {
SwapchainOpts::new().immutable(),
)?;
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("frag_grid").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_grid").unwrap(), // want panic
app.gfx.surface_format,
Some(AttachmentBlend::alpha()),
PrimitiveTopology::TriangleStrip,

View File

@@ -1,6 +1,7 @@
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(
dead_code,
clippy::default_trait_access,
clippy::cast_precision_loss,
clippy::cast_possible_truncation,
clippy::cast_sign_loss,

View File

@@ -60,8 +60,7 @@ where
color: wgui::drawing::Color::new(0., 0., 0., 0.6),
round: WLength::Units(4.0),
..Default::default()
})
.unwrap(),
}),
taffy::Style {
flex_direction: taffy::FlexDirection::Column,
padding: length(BACKGROUND_PADDING),
@@ -87,7 +86,7 @@ where
for row in 0..layout.key_sizes.len() {
let (div, _) = panel.layout.add_child(
background,
WidgetDiv::create().unwrap(),
WidgetDiv::create(),
taffy::Style {
flex_direction: taffy::FlexDirection::Row,
..Default::default()
@@ -108,7 +107,7 @@ where
let Some(key) = layout.get_key_data(keymap.as_ref(), has_altgr, col, row) else {
let _ = panel.layout.add_child(
div,
WidgetDiv::create()?,
WidgetDiv::create(),
taffy::Style {
size: taffy_size,
min_size: taffy_size,

View File

@@ -46,8 +46,8 @@ impl ScreenPipeline {
let extentf = [meta.extent[0] as f32, meta.extent[1] as f32];
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("frag_screen").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_screen").unwrap(), // want panic
app.gfx.surface_format,
Some(AttachmentBlend::default()),
PrimitiveTopology::TriangleStrip,

View File

@@ -17,7 +17,7 @@ use wgui::{
prelude::{auto, length, percent},
},
widget::{
label::{WidgetLabelParams, WidgetLabel},
label::{WidgetLabel, WidgetLabelParams},
rectangle::{WidgetRectangle, WidgetRectangleParams},
util::WLength,
},
@@ -182,8 +182,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
border: 1.0,
round: WLength::Units(4.0),
..Default::default()
})
.unwrap(),
}),
taffy::Style {
align_items: Some(taffy::AlignItems::Center),
justify_content: Some(taffy::JustifyContent::Center),
@@ -205,8 +204,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
..Default::default()
},
},
)
.unwrap(),
),
taffy::Style {
size: taffy::Size {
width: percent(1.0),
@@ -229,8 +227,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<(OverlayState, Box<dyn
..Default::default()
},
},
)
.unwrap(),
),
taffy::Style {
size: taffy::Size {
width: percent(1.0),

View File

@@ -123,8 +123,8 @@ impl WayVRBackend {
resolution: [u16; 2],
) -> anyhow::Result<Self> {
let pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap().clone(), // want panic
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
app.gfx_extras.shaders.get("frag_srgb").unwrap(), // want panic
app.gfx.surface_format,
None,
PrimitiveTopology::TriangleStrip,