mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-16 16:47:21 +02:00
chore: fix clippy (#3488)
This commit is contained in:
@@ -232,10 +232,9 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
let app_dir_ = app_dir.clone();
|
||||
|
||||
if let Some(fs_scope) = &fs_scope {
|
||||
let app_ = app.clone();
|
||||
fs_scope.listen(move |event| {
|
||||
if let tauri::fs::Event::PathAllowed(_) = event {
|
||||
save_scopes(&app_.fs_scope(), &app_dir, &fs_scope_state_path);
|
||||
save_scopes(&app.fs_scope(), &app_dir, &fs_scope_state_path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -479,10 +479,8 @@ fn read_line<F: Fn(Vec<u8>) -> CommandEvent + Send + Copy + 'static>(
|
||||
let _ = block_on_task(async move { tx_.send(wrapper(buf)).await });
|
||||
}
|
||||
Err(e) => {
|
||||
let tx_ = tx.clone();
|
||||
let _ = block_on_task(
|
||||
async move { tx_.send(CommandEvent::Error(e.to_string())).await },
|
||||
);
|
||||
let _ =
|
||||
block_on_task(async move { tx.send(CommandEvent::Error(e.to_string())).await });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,47 +452,47 @@ impl Builder {
|
||||
}
|
||||
}
|
||||
|
||||
WindowEvent::Moved(position) if state_flags.contains(StateFlags::POSITION) => {
|
||||
if window_clone
|
||||
.state::<RestoringWindowState>()
|
||||
.0
|
||||
.try_lock()
|
||||
.is_ok()
|
||||
&& !window_clone.is_minimized().unwrap_or_default()
|
||||
{
|
||||
let mut c = cache.lock().unwrap();
|
||||
if let Some(state) = c.get_mut(&label) {
|
||||
state.prev_x = state.x;
|
||||
state.prev_y = state.y;
|
||||
WindowEvent::Moved(position)
|
||||
if state_flags.contains(StateFlags::POSITION)
|
||||
&& window_clone
|
||||
.state::<RestoringWindowState>()
|
||||
.0
|
||||
.try_lock()
|
||||
.is_ok()
|
||||
&& !window_clone.is_minimized().unwrap_or_default() =>
|
||||
{
|
||||
let mut c = cache.lock().unwrap();
|
||||
if let Some(state) = c.get_mut(&label) {
|
||||
state.prev_x = state.x;
|
||||
state.prev_y = state.y;
|
||||
|
||||
state.x = position.x;
|
||||
state.y = position.y;
|
||||
}
|
||||
state.x = position.x;
|
||||
state.y = position.y;
|
||||
}
|
||||
}
|
||||
WindowEvent::Resized(size) if state_flags.contains(StateFlags::SIZE) => {
|
||||
if window_clone
|
||||
.state::<RestoringWindowState>()
|
||||
.0
|
||||
.try_lock()
|
||||
.is_ok()
|
||||
WindowEvent::Resized(size)
|
||||
if state_flags.contains(StateFlags::SIZE)
|
||||
&& window_clone
|
||||
.state::<RestoringWindowState>()
|
||||
.0
|
||||
.try_lock()
|
||||
.is_ok() =>
|
||||
{
|
||||
// TODO: Remove once https://github.com/tauri-apps/tauri/issues/5812 is resolved.
|
||||
let is_maximized = if cfg!(target_os = "macos")
|
||||
&& (!window_clone.is_decorated().unwrap_or_default()
|
||||
|| !window_clone.is_resizable().unwrap_or_default())
|
||||
{
|
||||
// TODO: Remove once https://github.com/tauri-apps/tauri/issues/5812 is resolved.
|
||||
let is_maximized = if cfg!(target_os = "macos")
|
||||
&& (!window_clone.is_decorated().unwrap_or_default()
|
||||
|| !window_clone.is_resizable().unwrap_or_default())
|
||||
{
|
||||
false
|
||||
} else {
|
||||
window_clone.is_maximized().unwrap_or_default()
|
||||
};
|
||||
false
|
||||
} else {
|
||||
window_clone.is_maximized().unwrap_or_default()
|
||||
};
|
||||
|
||||
if !window_clone.is_minimized().unwrap_or_default() && !is_maximized {
|
||||
let mut c = cache.lock().unwrap();
|
||||
if let Some(state) = c.get_mut(&label) {
|
||||
state.width = size.width;
|
||||
state.height = size.height;
|
||||
}
|
||||
if !window_clone.is_minimized().unwrap_or_default() && !is_maximized {
|
||||
let mut c = cache.lock().unwrap();
|
||||
if let Some(state) = c.get_mut(&label) {
|
||||
state.width = size.width;
|
||||
state.height = size.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user