mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Enable a few more clippy lints (#8064)
Enable these new clippy lints and fix all warnings: * `format_push_string` — use `write!` instead of `s += &format!(…)` to avoid extra allocations * `ignored_unit_patterns` — use `()` instead of `_` when matching unit * `missing_fields_in_debug` — ensure manual `Debug` impls account for all fields * `needless_raw_string_hashes` — remove unnecessary `r#` on string literals * `ref_option` — prefer `Option<&T>` over `&Option<T>` in function signatures
This commit is contained in:
@@ -427,37 +427,52 @@ pub fn adapter_info_summary(info: &wgpu::AdapterInfo) -> String {
|
||||
// > name: "Apple M1 Pro", device_type: IntegratedGpu, backend: Metal, driver: "", driver_info: ""
|
||||
// > name: "ANGLE (Apple, Apple M1 Pro, OpenGL 4.1)", device_type: IntegratedGpu, backend: Gl, driver: "", driver_info: ""
|
||||
|
||||
use std::fmt::Write as _;
|
||||
|
||||
let mut summary = format!("backend: {backend:?}, device_type: {device_type:?}");
|
||||
|
||||
if !name.is_empty() {
|
||||
summary += &format!(", name: {name:?}");
|
||||
write!(summary, ", name: {name:?}").ok();
|
||||
}
|
||||
if !driver.is_empty() {
|
||||
summary += &format!(", driver: {driver:?}");
|
||||
write!(summary, ", driver: {driver:?}").ok();
|
||||
}
|
||||
if !driver_info.is_empty() {
|
||||
summary += &format!(", driver_info: {driver_info:?}");
|
||||
write!(summary, ", driver_info: {driver_info:?}").ok();
|
||||
}
|
||||
if *vendor != 0 {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
summary += &format!(", vendor: {} (0x{vendor:04X})", parse_vendor_id(*vendor));
|
||||
write!(
|
||||
summary,
|
||||
", vendor: {} (0x{vendor:04X})",
|
||||
parse_vendor_id(*vendor)
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
summary += &format!(", vendor: 0x{vendor:04X}");
|
||||
write!(summary, ", vendor: 0x{vendor:04X}").ok();
|
||||
}
|
||||
}
|
||||
if *device != 0 {
|
||||
summary += &format!(", device: 0x{device:02X}");
|
||||
write!(summary, ", device: 0x{device:02X}").ok();
|
||||
}
|
||||
if !device_pci_bus_id.is_empty() {
|
||||
summary += &format!(", pci_bus_id: {device_pci_bus_id:?}");
|
||||
write!(summary, ", pci_bus_id: {device_pci_bus_id:?}").ok();
|
||||
}
|
||||
if *subgroup_min_size != 0 || *subgroup_max_size != 0 {
|
||||
summary += &format!(", subgroup_size: {subgroup_min_size}..={subgroup_max_size}");
|
||||
write!(
|
||||
summary,
|
||||
", subgroup_size: {subgroup_min_size}..={subgroup_max_size}"
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
summary += &format!(", transient_saves_memory: {transient_saves_memory}");
|
||||
write!(
|
||||
summary,
|
||||
", transient_saves_memory: {transient_saves_memory}"
|
||||
)
|
||||
.ok();
|
||||
|
||||
summary
|
||||
}
|
||||
|
||||
@@ -296,15 +296,22 @@ impl Clone for WgpuSetupCreateNew {
|
||||
|
||||
impl std::fmt::Debug for WgpuSetupCreateNew {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let Self {
|
||||
instance_descriptor,
|
||||
display_handle,
|
||||
power_preference,
|
||||
native_adapter_selector,
|
||||
device_descriptor: _,
|
||||
} = self;
|
||||
f.debug_struct("WgpuSetupCreateNew")
|
||||
.field("instance_descriptor", &self.instance_descriptor)
|
||||
.field("display_handle", &self.display_handle)
|
||||
.field("power_preference", &self.power_preference)
|
||||
.field("instance_descriptor", instance_descriptor)
|
||||
.field("display_handle", display_handle)
|
||||
.field("power_preference", power_preference)
|
||||
.field(
|
||||
"native_adapter_selector",
|
||||
&self.native_adapter_selector.is_some(),
|
||||
&native_adapter_selector.is_some(),
|
||||
)
|
||||
.finish()
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user