Skip to content

Commit

Permalink
Merge pull request #681 from Stremio/fix/linting-for-rust-1-78
Browse files Browse the repository at this point in the history
fix: clippy warnings from Rust 1.78
  • Loading branch information
elpiel authored May 3, 2024
2 parents 256ec32 + 95c73a9 commit edfda69
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/models/common/resource_loadable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ where
ResourceAction::ResourceRequested { request }
if resource.request != *request || resource.content.is_none() =>
{
resource.request = request.to_owned();
request.clone_into(&mut resource.request);
resource.content = Some(Loadable::Loading);
Effects::future(EffectFuture::Concurrent(
E::addon_transport(&request.base)
Expand Down
10 changes: 5 additions & 5 deletions src/models/ctx/update_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub fn update_profile<E: Env + 'static>(
if addon.flags.protected || profile.addons[addon_position].flags.protected {
return addon_upgrade_error_effects(addon, OtherError::AddonIsProtected);
}
profile.addons[addon_position] = addon.to_owned();
addon.clone_into(&mut profile.addons[addon_position]);
let push_to_api_effects = match profile.auth_key() {
Some(auth_key) => {
Effects::one(push_addons_to_api::<E>(profile.addons.to_owned(), auth_key))
Expand Down Expand Up @@ -223,7 +223,7 @@ pub fn update_profile<E: Env + 'static>(
},
Msg::Action(Action::Ctx(ActionCtx::UpdateSettings(settings))) => {
if profile.settings != *settings {
profile.settings = settings.to_owned();
settings.clone_into(&mut profile.settings);
Effects::msg(Msg::Event(Event::SettingsUpdated {
settings: settings.to_owned(),
}))
Expand Down Expand Up @@ -251,7 +251,7 @@ pub fn update_profile<E: Env + 'static>(
.map(|addon| &addon.transport_url)
.position(|transport_url| *transport_url == addon.transport_url);
if let Some(addon_position) = addon_position {
profile.addons[addon_position] = addon.to_owned();
addon.clone_into(&mut profile.addons[addon_position]);
} else {
profile.addons.push(addon.to_owned());
};
Expand Down Expand Up @@ -324,7 +324,7 @@ pub fn update_profile<E: Env + 'static>(
.chain(removed_transport_urls)
.collect();
let profile_changed_effects = if profile.addons != *addons {
profile.addons = addons.to_owned();
addons.clone_into(&mut profile.addons);

Effects::msg(Msg::Internal(Internal::ProfileChanged))
} else {
Expand Down Expand Up @@ -359,7 +359,7 @@ pub fn update_profile<E: Env + 'static>(
match result {
Ok(user) => match &mut profile.auth {
Some(auth) if auth.user != *user => {
auth.user = user.to_owned();
user.clone_into(&mut auth.user);
Effects::msg(Msg::Event(Event::UserPulledFromAPI { uid: profile.uid() }))
.join(Effects::msg(Msg::Internal(Internal::ProfileChanged)))
}
Expand Down
11 changes: 7 additions & 4 deletions src/models/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {
.overall_time_watched
.saturating_add(time_watched);
};
library_item.state.time_offset = time.to_owned();
library_item.state.duration = duration.to_owned();
time.clone_into(&mut library_item.state.time_offset);
duration.clone_into(&mut library_item.state.duration);
if library_item.state.flagged_watched == 0
&& library_item.state.time_watched as f64
> library_item.state.duration as f64 * WATCHED_THRESHOLD_COEF
Expand All @@ -452,7 +452,10 @@ impl<E: Env + 'static> UpdateWithCtx<E> for Player {
library_item.temp = true;
};
if let Some(analytics_context) = &mut self.analytics_context {
analytics_context.video_id = library_item.state.video_id.to_owned();
library_item
.state
.video_id
.clone_into(&mut analytics_context.video_id);
analytics_context.time = Some(library_item.state.time_offset);
analytics_context.duration = Some(library_item.state.duration);
analytics_context.device_type = Some(device.to_owned());
Expand Down Expand Up @@ -870,7 +873,7 @@ where

match next_video {
Some(next_video) => {
stream_request.path.id = next_video.id.clone();
stream_request.path.id.clone_from(&next_video.id);

match next_streams.as_mut() {
Some(next_streams) => resource_update_with_vector_content::<E, _>(
Expand Down

0 comments on commit edfda69

Please sign in to comment.