File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ assets = [
211211]
212212
213213[workspace .lints ]
214+ clippy.implicit_clone = " warn"
214215clippy.redundant_closure_for_method_calls = " warn"
215216
216217[lints ]
Original file line number Diff line number Diff line change @@ -468,14 +468,14 @@ impl ConnectState {
468468 // - queue resorting is done by each client and orients itself by the given uid
469469 // - if no uid is present, resorting doesn't work or behaves not as intended
470470 let uid = match ctx_track. uid . as_ref ( ) {
471- Some ( uid) if !uid. is_empty ( ) => uid. to_string ( ) ,
471+ Some ( uid) if !uid. is_empty ( ) => uid. clone ( ) ,
472472 // so providing a unique id should allow to resort the queue
473473 _ => Uuid :: new_v4 ( ) . as_simple ( ) . to_string ( ) ,
474474 } ;
475475
476476 let mut metadata = page_metadata. cloned ( ) . unwrap_or_default ( ) ;
477477 for ( k, v) in & ctx_track. metadata {
478- metadata. insert ( k. to_string ( ) , v. to_string ( ) ) ;
478+ metadata. insert ( k. clone ( ) , v. clone ( ) ) ;
479479 }
480480
481481 let mut track = ProvidedTrack {
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ impl Login5Manager {
183183 }
184184
185185 let method = Login_method :: StoredCredential ( StoredCredential {
186- username : self . session ( ) . username ( ) . to_string ( ) ,
186+ username : self . session ( ) . username ( ) . clone ( ) ,
187187 data : auth_data,
188188 ..Default :: default ( )
189189 } ) ;
Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ impl SpClient {
306306 challenge_answer. ChallengeType =
307307 ChallengeType :: CHALLENGE_HASH_CASH . into ( ) ;
308308
309- challenge_answers. state = state. to_string ( ) ;
309+ challenge_answers. state = state. clone ( ) ;
310310 challenge_answers. answers . push ( challenge_answer) ;
311311
312312 trace ! ( "Answering hash cash challenge" ) ;
@@ -347,7 +347,7 @@ impl SpClient {
347347 } ;
348348
349349 let granted_token = token_response. granted_token ( ) ;
350- let access_token = granted_token. token . to_owned ( ) ;
350+ let access_token = granted_token. token . clone ( ) ;
351351
352352 self . lock ( |inner| {
353353 let client_token = Token {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl TokenProvider {
9797 ) ;
9898 let request = self . session ( ) . mercury ( ) . get ( query_uri) ?;
9999 let response = request. await ?;
100- let data = response. payload . first ( ) . ok_or ( TokenError :: Empty ) ?. to_vec ( ) ;
100+ let data = response. payload . first ( ) . ok_or ( TokenError :: Empty ) ?. clone ( ) ;
101101 let token = Token :: from_json ( String :: from_utf8 ( data) ?) ?;
102102 trace ! ( "Got token: {token:#?}" ) ;
103103 self . lock ( |inner| inner. tokens . push ( token. clone ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ impl RequestHandler {
156156
157157 let encrypted_blob_len = encrypted_blob. len ( ) ;
158158 if encrypted_blob_len < 16 {
159- return Err ( DiscoveryError :: HmacError ( encrypted_blob. to_vec ( ) ) . into ( ) ) ;
159+ return Err ( DiscoveryError :: HmacError ( encrypted_blob. clone ( ) ) . into ( ) ) ;
160160 }
161161
162162 let iv = & encrypted_blob[ 0 ..16 ] ;
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ impl TryFrom<&<Self as Metadata>::Message> for Album {
101101 covers : album. cover_group . get_or_default ( ) . into ( ) ,
102102 external_ids : album. external_id . as_slice ( ) . into ( ) ,
103103 discs : album. disc . as_slice ( ) . try_into ( ) ?,
104- reviews : album. review . to_vec ( ) ,
104+ reviews : album. review . clone ( ) ,
105105 copyrights : album. copyright . as_slice ( ) . into ( ) ,
106106 restrictions : album. restriction . as_slice ( ) . into ( ) ,
107107 related : album. related . as_slice ( ) . try_into ( ) ?,
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ impl TryFrom<&AvailabilityMessage> for Availability {
4141 type Error = librespot_core:: Error ;
4242 fn try_from ( availability : & AvailabilityMessage ) -> Result < Self , Self :: Error > {
4343 Ok ( Self {
44- catalogue_strs : availability. catalogue_str . to_vec ( ) ,
44+ catalogue_strs : availability. catalogue_str . clone ( ) ,
4545 start : availability. start . get_or_default ( ) . try_into ( ) ?,
4646 } )
4747 }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ impl From<&ContentRatingMessage> for ContentRating {
2323 fn from ( content_rating : & ContentRatingMessage ) -> Self {
2424 Self {
2525 country : content_rating. country ( ) . to_owned ( ) ,
26- tags : content_rating. tag . to_vec ( ) ,
26+ tags : content_rating. tag . clone ( ) ,
2727 }
2828 }
2929}
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl TryFrom<&<Self as Metadata>::Message> for Episode {
9090 audio_previews : episode. audio_preview . as_slice ( ) . into ( ) ,
9191 restrictions : episode. restriction . as_slice ( ) . into ( ) ,
9292 freeze_frames : episode. freeze_frame . image . as_slice ( ) . into ( ) ,
93- keywords : episode. keyword . to_vec ( ) ,
93+ keywords : episode. keyword . clone ( ) ,
9494 allow_background_playback : episode. allow_background_playback ( ) ,
9595 availability : episode. availability . as_slice ( ) . try_into ( ) ?,
9696 external_url : episode. external_url ( ) . to_owned ( ) ,
You can’t perform that action at this time.
0 commit comments