Skip to content

Commit

Permalink
lint: cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hpp2334 committed Nov 26, 2024
1 parent 20bc282 commit 96f6390
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 68 deletions.
4 changes: 2 additions & 2 deletions misty-vm/misty-async/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{
future::Future,
sync::{
atomic::{AtomicBool, AtomicU64},
Arc, RwLock,
atomic::AtomicBool,
Arc,
},
time::Duration,
};
Expand Down
6 changes: 2 additions & 4 deletions misty-vm/misty-vm-test/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
use std::{
future::Future,
pin::Pin,
sync::{
atomic::{AtomicBool, AtomicI64},
atomic::AtomicBool,
Arc, Mutex,
},
thread::ThreadId,
time::Duration,
};

use misty_vm::{App, AppPod, BoxFuture, IAsyncRuntimeAdapter, IOnAsyncRuntime, LocalBoxFuture};
use misty_vm::{BoxFuture, IAsyncRuntimeAdapter, IOnAsyncRuntime};

use crate::timer::FakeTimers;

Expand Down
2 changes: 0 additions & 2 deletions misty-vm/misty-vm-test/src/timer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::cell::RefCell;
use std::future::Future;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::atomic::AtomicU64;
use std::sync::{Arc, RwLock};
use std::task::{Context, Poll, Waker};
Expand Down
4 changes: 2 additions & 2 deletions misty-vm/misty-vm/src/app/builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{any::Any, fmt::Debug, sync::Arc};
use std::{any::Any, sync::Arc};

use misty_async::{AsyncRuntime, IAsyncRuntimeAdapter};
use misty_async::AsyncRuntime;

use crate::{
async_task::DefaultAsyncRuntimeAdapter, models::Models, to_host::ToHostsBuilder,
Expand Down
2 changes: 0 additions & 2 deletions misty-vm/misty-vm/src/app/pod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::{
any::Any,
cell::RefCell,
collections::HashMap,
fmt::Debug,
rc::Rc,
sync::{atomic::AtomicU64, Arc, RwLock},
};

Expand Down
9 changes: 3 additions & 6 deletions misty-vm/misty-vm/src/async_task.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use std::{
cell::{Ref, RefCell},
cell::RefCell,
collections::HashMap,
future::Future,
hash::Hash,
ops::DerefMut,
rc::Rc,
sync::{atomic::AtomicU64, Arc},
time::Duration,
};

use async_task::{Runnable, Task};
use futures::future::LocalBoxFuture;
use misty_async::{AsyncRuntime, BoxFuture, IAsyncRuntimeAdapter};
use async_task::Task;
use misty_async::{BoxFuture, IAsyncRuntimeAdapter};

use crate::internal::{AppInternal, WeakAppInternal};

#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub struct AsyncTaskId(u64);
Expand Down
4 changes: 1 addition & 3 deletions misty-vm/misty-vm/src/view_models/context.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use std::{
any::Any,
convert::Infallible,
fmt::Debug,
future::Future,
sync::{Arc, Weak},
sync::Arc,
time::Duration,
};

use misty_async::AsyncRuntime;

use crate::{
async_task::{AsyncTaskId, AsyncTaskPod, AsyncTasks},
Expand Down
1 change: 0 additions & 1 deletion misty-vm/misty-vm/src/view_models/pod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
any::{Any, TypeId},
fmt::Debug,
rc::Rc,
sync::Arc,
};
Expand Down
6 changes: 1 addition & 5 deletions rust-libs/ease-client-android/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ use ease_client_shared::backends::{
app::ArgInitializeApp, encode_message_payload, generated::Code, player::PlayerDelegateEvent,
storage::DataSourceKey, MessagePayload,
};
use misty_vm::{AppPods, AsyncRuntime, BoxFuture, IAsyncRuntimeAdapter, LocalBoxFuture};
use once_cell::sync::Lazy;
use misty_vm::{AsyncRuntime, BoxFuture, IAsyncRuntimeAdapter};

use tokio::runtime::Runtime;
use tracing::subscriber::set_global_default;

use crate::{
backend_host::BackendHost,
error::AndroidFfiError,
foreigns::{
AssetLoadDelegate, IAssetLoadDelegateForeign, IAsyncAdapterForeign,
IPermissionServiceForeign, IPlayerDelegateForeign, IRouterServiceForeign,
Expand Down
2 changes: 1 addition & 1 deletion rust-libs/ease-client-backend/src/controllers/music.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{sync::Arc, time::Duration};
use std::sync::Arc;

use ease_client_shared::backends::music::{ArgUpdateMusicLyric, Music, MusicId};
use futures::try_join;
Expand Down
2 changes: 1 addition & 1 deletion rust-libs/ease-client-backend/src/controllers/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ease_client_shared::backends::{
music::MusicId,
playlist::{
ArgAddMusicsToPlaylist, ArgCreatePlaylist, ArgRemoveMusicFromPlaylist, ArgUpdatePlaylist,
Playlist, PlaylistAbstract, PlaylistId,
Playlist, PlaylistId,
},
};
use futures::try_join;
Expand Down
6 changes: 3 additions & 3 deletions rust-libs/ease-client-backend/src/controllers/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use ease_client_shared::backends::storage::{
ArgUpsertStorage, ListStorageEntryChildrenResp, Storage, StorageConnectionTestResult,
StorageEntry, StorageEntryLoc, StorageId, StorageType,
StorageEntry, StorageEntryLoc, StorageId,
};
use ease_remote_storage::OneDriveBackend;
use futures::try_join;
Expand All @@ -14,13 +14,13 @@ use crate::{
core::get_conn,
music::db_get_playlists_count_by_storage,
playlist::{db_get_musics_count_by_storage, db_remove_musics_in_playlists_by_storage},
storage::{db_load_storage, db_load_storages, db_remove_storage, db_upsert_storage},
storage::{db_load_storage, db_remove_storage, db_upsert_storage},
},
services::{
playlist::notify_all_playlist_abstracts,
storage::{
build_storage, build_storage_backend_by_arg, evict_storage_backend_cache,
get_storage_backend, list_storage, notify_storages,
get_storage_backend, notify_storages,
},
},
};
Expand Down
3 changes: 1 addition & 2 deletions rust-libs/ease-client-backend/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{
collections::HashMap,
fmt::Debug,
sync::{
atomic::{AtomicU16, AtomicU32, AtomicUsize},
atomic::{AtomicU32, AtomicUsize},
Arc, RwLock,
},
time::Duration,
Expand All @@ -15,7 +15,6 @@ use misty_async::AsyncRuntime;
use crate::services::{
music::TimeToPauseState,
player::{IPlayerDelegate, PlayerState},
server::AssetServer,
storage::StorageState,
};

Expand Down
1 change: 0 additions & 1 deletion rust-libs/ease-client-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub(crate) mod utils;

use ease_client_shared::backends::{
app::ArgInitializeApp, connector::IConnectorNotifier, message::MessagePayload,
storage::DataSourceKey,
};
pub use ease_remote_storage::StreamFile;
use error::BResult;
Expand Down
1 change: 0 additions & 1 deletion rust-libs/ease-client-backend/src/services/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod serve;

use std::{
collections::HashMap,
default,
sync::{atomic::AtomicU64, Arc, RwLock},
};

Expand Down
7 changes: 3 additions & 4 deletions rust-libs/ease-client-backend/src/services/server/serve.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use std::{collections::HashMap, net::SocketAddr, sync::Arc};
use std::sync::Arc;

use base64::{engine::general_purpose::URL_SAFE, Engine as _};
use ease_client_shared::backends::{
music::MusicId,
storage::{StorageEntryLoc, StorageId},
storage::StorageEntryLoc,
};
use ease_remote_storage::StreamFile;

use crate::{
ctx::BackendContext,
error::{BError, BResult},
error::BResult,
services::{
music::{get_music_cover_bytes, get_music_storage_entry_loc},
storage::get_storage_backend,
Expand Down
7 changes: 2 additions & 5 deletions rust-libs/ease-client/src/view_models/connector/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
use std::{sync::Arc, time::Duration};
use std::sync::Arc;

use ease_client_shared::backends::{
connector::{ConnectorAction, IConnectorNotifier},
generated::*,
message::{decode_message_payload, encode_message_payload, IMessage, MessagePayload},
music::*,
player::{ArgPlayMusic, PlayMode, PlayerCurrentPlaying},
playlist::*,
storage::*,
};
use misty_vm::{
AppBuilderContext, AsyncTasks, AsyncViewModelContext, BoxFuture, IToHost, Model, ViewModel,
AppBuilderContext, AsyncTasks, AsyncViewModelContext, IToHost, Model, ViewModel,
ViewModelContext,
};
use state::ConnectorState;
Expand Down
5 changes: 0 additions & 5 deletions rust-libs/ease-client/src/view_models/connector/state.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use base64::{engine::general_purpose::URL_SAFE, Engine as _};
use ease_client_shared::backends::{
music::MusicId,
storage::{DataSourceKey, StorageEntryLoc},
};

#[derive(Default, Clone)]
pub struct ConnectorState {
Expand Down
2 changes: 1 addition & 1 deletion rust-libs/ease-client/src/view_models/main/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
RoutesKey,
};

use super::music::{common::MusicCommonVM, control::MusicControlVM, time_to_pause::TimeToPauseVM};
use super::music::{common::MusicCommonVM, time_to_pause::TimeToPauseVM};

pub mod router;
pub mod state;
Expand Down
3 changes: 1 addition & 2 deletions rust-libs/ease-client/src/view_models/music/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{sync::atomic::AtomicBool, time::Duration};
use std::time::Duration;

use ease_client_shared::backends::{
connector::ConnectorAction,
Expand All @@ -17,7 +17,6 @@ use crate::{

use super::{
control::MusicControlVM,
lyric::MusicLyricVM,
state::{CurrentMusicState, TimeToPauseState},
time_to_pause::TimeToPauseVM,
};
Expand Down
2 changes: 1 addition & 1 deletion rust-libs/ease-client/src/view_models/music/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ease_client_shared::backends::{
playlist::Playlist,
};
use misty_vm::{
AppBuilderContext, AsyncTaskPod, AsyncTasks, IToHost, Model, ViewModel, ViewModelContext,
AppBuilderContext, AsyncTasks, IToHost, Model, ViewModel, ViewModelContext,
};

use super::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
view_models::connector::Connector,
};

use super::{common::MusicCommonVM, control::MusicControlVM, state::TimeToPauseState};
use super::{common::MusicCommonVM, state::TimeToPauseState};

#[derive(Debug, Clone, uniffi::Enum)]
pub enum TimeToPauseWidget {
Expand Down
2 changes: 1 addition & 1 deletion rust-libs/ease-client/src/view_models/storage/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};

use ease_client_shared::backends::storage::{
ArgUpsertStorage, CurrentStorageImportType, CurrentStorageStateType, Storage,
StorageConnectionTestResult, StorageEntry, StorageEntryType, StorageId, StorageType,
StorageConnectionTestResult, StorageEntry, StorageId, StorageType,
};
use serde::Serialize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ use serde::Serialize;

use crate::{
utils::common::{decode_component_or_origin, get_display_duration},
view_models::{
connector::state::ConnectorState,
playlist::state::{
view_models::playlist::state::{
AllPlaylistState, CreatePlaylistState, CurrentPlaylistState, EditPlaylistState,
},
},
};

use super::models::RootViewModelState;
Expand Down Expand Up @@ -66,7 +63,7 @@ pub struct VCreatePlaylistState {
pub can_submit: bool,
}

pub(crate) fn playlist_list_vs((state): (&AllPlaylistState), root: &mut RootViewModelState) {
pub(crate) fn playlist_list_vs(state: &AllPlaylistState, root: &mut RootViewModelState) {
let mut list: Vec<_> = { state.playlists.iter().map(|item| item.clone()).collect() };
list.sort_by(|lhs, rhs| {
rhs.created_time()
Expand Down
1 change: 0 additions & 1 deletion rust-libs/ease-remote-storage/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::io::ErrorKind;

use async_stream::stream;
use async_trait::async_trait;
use bytes::Bytes;
use futures_util::future::BoxFuture;
use reqwest::StatusCode;
Expand Down
4 changes: 1 addition & 3 deletions rust-libs/ease-remote-storage/src/impls/local.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::{io::SeekFrom, sync::Mutex};
use std::io::SeekFrom;

use async_trait::async_trait;
use futures_util::future::BoxFuture;
use once_cell::sync::Lazy;
use tokio::io::{AsyncReadExt, AsyncSeekExt};

use crate::{Entry, StorageBackend, StorageBackendResult, StreamFile};
Expand Down
3 changes: 1 addition & 2 deletions rust-libs/ease-remote-storage/src/impls/onedrive.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::{cmp::Ordering, sync::RwLock, time::Duration};
use std::{cmp::Ordering, time::Duration};


use futures_util::future::BoxFuture;
use reqwest::header::HeaderValue;
use reqwest::StatusCode;
use serde::Deserialize;

use crate::{
env::EASEM_ONEDRIVE_ID, Entry, StorageBackend, StorageBackendError, StorageBackendResult, StreamFile,
Expand Down
1 change: 0 additions & 1 deletion rust-libs/ease-remote-storage/src/impls/webdav.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::backend::{Entry, StorageBackend, StorageBackendResult, StreamFile};
use crate::StorageBackendError;

use async_trait::async_trait;

use futures_util::future::BoxFuture;
use reqwest::header::HeaderValue;
Expand Down

0 comments on commit 96f6390

Please sign in to comment.