From 18dbdb5745d8332103981295f9717c21bfa43435 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 4 Aug 2023 16:01:11 +0300 Subject: [PATCH] fix: clippy & rustfmt Signed-off-by: Lachezar Lechev --- .github/workflows/build.yml | 4 ++-- Cargo.toml | 1 - build.rs | 2 +- src/commonMain/rust/bridge/event.rs | 4 ++-- src/commonMain/rust/env/kotlin_class_name.rs | 2 +- src/commonMain/rust/model/model.rs | 7 ++++++- src/commonMain/rust/stremio_core_android.rs | 8 +++++--- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7db6bcd..4bc9e80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,9 +19,9 @@ jobs: - name: Build code run: cargo build - name: Lint code format - run: cargo fmt --all -- --check + run: cargo fmt --all --check - name: Lint code - run: cargo clippy --all -- -D warnings + run: cargo clippy --no-deps -- -D warnings # MSRV - name: Check MSRV diff --git a/Cargo.toml b/Cargo.toml index 9179d56..0abe3ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,6 @@ jni = "0.19" reqwest = { version = "0.11", features = ["json", "rustls-tls"] } tokio = { version = "1", features = ["rt", "rt-multi-thread", "sync"] } openssl = { version = "0.10", features = ["vendored"] } -# bytes = "1.1" prost = "0.11" prost-types = "0.11" http-cache-reqwest = "0.11" diff --git a/build.rs b/build.rs index ab491a0..ea016eb 100644 --- a/build.rs +++ b/build.rs @@ -12,7 +12,7 @@ fn main() { println!("cargo:rerun-if-changed={display_path}"); } let file_descriptors = - protox::compile(proto_paths, &[proto_dir]).expect("Expected file descriptors"); + protox::compile(proto_paths, [proto_dir]).expect("Expected file descriptors"); Config::new() .compile_well_known_types() .out_dir("src/commonMain/rust/protobuf") diff --git a/src/commonMain/rust/bridge/event.rs b/src/commonMain/rust/bridge/event.rs index 03eefa4..c663b58 100644 --- a/src/commonMain/rust/bridge/event.rs +++ b/src/commonMain/rust/bridge/event.rs @@ -18,10 +18,10 @@ impl ToProtobuf for Event { runtime::event::LibraryItemsPushedToStorage { ids: ids.clone() }, ) } - Event::StreamsPushedToStorage { uid } => { + Event::StreamsPushedToStorage { uid: _ } => { todo!() } - Event::NotificationsPushedToStorage { ids } => { + Event::NotificationsPushedToStorage { ids: _ } => { todo!() } Event::UserPulledFromAPI { uid } => { diff --git a/src/commonMain/rust/env/kotlin_class_name.rs b/src/commonMain/rust/env/kotlin_class_name.rs index 6305d7b..651c30c 100644 --- a/src/commonMain/rust/env/kotlin_class_name.rs +++ b/src/commonMain/rust/env/kotlin_class_name.rs @@ -1,6 +1,6 @@ use std::convert::TryFrom; use std::hash::Hash; -use strum::{IntoEnumIterator, EnumIter}; +use strum::{EnumIter, IntoEnumIterator}; #[derive(Clone, PartialEq, Eq, Hash, EnumIter)] #[allow(non_camel_case_types)] diff --git a/src/commonMain/rust/model/model.rs b/src/commonMain/rust/model/model.rs index 1c5450d..0125c91 100644 --- a/src/commonMain/rust/model/model.rs +++ b/src/commonMain/rust/model/model.rs @@ -42,7 +42,12 @@ pub struct AndroidModel { } impl AndroidModel { - pub fn new(profile: Profile, library: LibraryBucket, streams: StreamsBucket, notifications: NotificationsBucket) -> (AndroidModel, Effects) { + pub fn new( + profile: Profile, + library: LibraryBucket, + streams: StreamsBucket, + notifications: NotificationsBucket, + ) -> (AndroidModel, Effects) { let (continue_watching_preview, continue_watching_preview_effects) = ContinueWatchingPreview::new(&library, ¬ifications); diff --git a/src/commonMain/rust/stremio_core_android.rs b/src/commonMain/rust/stremio_core_android.rs index 1200bd8..e700327 100644 --- a/src/commonMain/rust/stremio_core_android.rs +++ b/src/commonMain/rust/stremio_core_android.rs @@ -76,9 +76,11 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative( library.merge_bucket(other_bucket); }; let streams = streams.unwrap_or(StreamsBucket::new(profile.uid())); - let notifications = notifications.unwrap_or( - NotificationsBucket::new::(profile.uid(), vec![]), - ); + let notifications = notifications.unwrap_or(NotificationsBucket::new::< + AndroidEnv, + >( + profile.uid(), vec![] + )); let (model, effects) = AndroidModel::new(profile, library, streams, notifications); let (runtime, rx) = Runtime::::new(