Skip to content

Commit 8faf8c2

Browse files
committed
accept clippy suggestions
1 parent 4e99df0 commit 8faf8c2

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

src-tauri/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async fn get_open_files_dialog_path(app: AppHandle) -> String {
152152
};
153153
store.set(
154154
OPEN_FILES_DIALOG_PATH_KEY,
155-
path.to_string_lossy().to_owned(),
155+
path.to_string_lossy().into_owned(),
156156
);
157157
}
158158
let path = store.get(OPEN_FILES_DIALOG_PATH_KEY).unwrap();
@@ -585,9 +585,7 @@ pub fn run() {
585585

586586
#[cfg(debug_assertions)]
587587
{
588-
_dev_default_open_path = Some(PathBuf::from(
589-
get_project_root().join("samples/stereo/sample_48k.wav"),
590-
));
588+
_dev_default_open_path = Some(get_project_root().join("samples/stereo/sample_48k.wav"));
591589
}
592590
rayon::ThreadPoolBuilder::new()
593591
.num_threads(num_cpus::get_physical())
@@ -628,8 +626,8 @@ pub fn run() {
628626
.plugin(tauri_plugin_opener::init())
629627
.plugin(tauri_plugin_os::init())
630628
.plugin(tauri_plugin_window_state::Builder::new().build())
631-
.menu(|app| menu::build(app))
632-
.on_menu_event(|app, event| menu::handle_menu_event(app, event))
629+
.menu(menu::build)
630+
.on_menu_event(menu::handle_menu_event)
633631
.setup(|app| {
634632
let handle = app.handle().clone();
635633
menu::init(&handle)?;

src-tauri/src/menu.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,21 @@ pub fn build<R: Runtime>(app: &AppHandle<R>) -> tauri::Result<Menu<R>> {
8585

8686
let help_menu = build_help_menu(app)?;
8787

88-
let mut top_level: Vec<&dyn IsMenuItem<R>> = Vec::new();
89-
90-
#[cfg(target_os = "macos")]
91-
top_level.push(&app_menu);
92-
93-
top_level.push(&file_menu);
94-
9588
#[cfg(target_os = "macos")]
96-
top_level.push(&edit_menu);
89+
let top_level: Vec<&dyn IsMenuItem<R>> = vec![
90+
&app_menu,
91+
&file_menu,
92+
&edit_menu,
93+
&view_menu,
94+
&tracks_menu,
95+
&play_menu,
96+
&window_menu,
97+
&help_menu,
98+
];
9799

98-
top_level.push(&view_menu);
99-
top_level.push(&tracks_menu);
100-
top_level.push(&play_menu);
101-
102-
#[cfg(target_os = "macos")]
103-
top_level.push(&window_menu);
104-
105-
top_level.push(&help_menu);
100+
#[cfg(not(target_os = "macos"))]
101+
let top_level: Vec<&dyn IsMenuItem<R>> =
102+
vec![&file_menu, &view_menu, &tracks_menu, &play_menu, &help_menu];
106103

107104
Menu::with_items(app, &top_level)
108105
}

thesia-wasm-renderer/src/spec_mipmap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::cell::RefCell;
22
use std::collections::HashMap;
33
use std::sync::LazyLock;
4-
use std::u8;
54

65
use fast_image_resize::images::{TypedImage, TypedImageRef};
76
use fast_image_resize::{FilterType, ResizeAlg, ResizeOptions, Resizer, pixels};
@@ -44,7 +43,7 @@ fn serialize_2d_array(array: ArrayView2<f32>) -> WasmU8Array {
4443
Vec::with_capacity(2 * size_of::<u32>() + array.len() * size_of::<f32>());
4544
buf.extend_from_slice(&array.shape()[0].to_le_bytes());
4645
buf.extend_from_slice(&array.shape()[1].to_le_bytes());
47-
buf.extend_from_slice(to_byte_slice(&array.as_slice().unwrap()));
46+
buf.extend_from_slice(to_byte_slice(array.as_slice().unwrap()));
4847
WasmU8Array::from_vec(buf)
4948
}
5049

@@ -104,6 +103,6 @@ fn u16_to_f32(x: pixels::U16) -> f32 {
104103
(x.0 as f32) / u16::MAX as f32
105104
}
106105

107-
fn to_byte_slice<'a>(floats: &'a [f32]) -> &'a [u8] {
106+
fn to_byte_slice(floats: &[f32]) -> &[u8] {
108107
unsafe { std::slice::from_raw_parts(floats.as_ptr() as *const _, floats.len() * 4) }
109108
}

0 commit comments

Comments
 (0)