[GH-ISSUE #204] Extreme clippy linting #67

Closed
opened 2026-02-27 20:22:55 +03:00 by kerem · 5 comments
Owner

Originally created by @marioortizmanero on GitHub (Apr 20, 2021).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/204

Is your feature request related to a problem? Please describe.

I just learned about the more "extreme" clippy lints, which can be enabled by adding this to the header of lib.rs:

#![warn(
    clippy::all,
    clippy::restriction,
    clippy::pedantic,
    clippy::nursery,
    clippy::cargo,
)]

They are "extreme" for a reason; it might not be a good idea to have them always enabled because they can be annoying/wrong, but I think it's a good idea to try it out from time to time and consider its suggestions in a discussion like this. Here's a summary of the lints it found:

  1. unnested-or-patterns: simplifying or patterns in match expressions.
  2. unseparated-literal-suffix: 100_u8 might look more readable than 100u8, but
  3. module-name-repetitions: Some names are repetitive. For example one user might use rspotify::client and then access its items with client::, but that would be repetitive in cases like ClientError or ClientResult, which would look like client::ClientError.
    This also includes cases like album::SimplifiedAlbum, which are more complicated because we try to follow the same Spotify names.
  4. if-not-else: avoiding unnecessary ! might make code more readable.
  5. pub_enum_variant_names: if every variant in an enum has a word, we might as well move it to the enum's name itself or just remove them.
  6. as_conversions: as conversions that might lose data. Note that most of them aren't rally necessary, including the unsafe transformation for Id, about which there's not much else to do.
  7. unreadable_literal: using _ digit separators; 1_000_000 is more readable than 1000000.

You can find examples of the lints I mentioned by searching in the following log:

Full output for `default` branch
❯ cargo clippy --all -- -D warnings
    Blocking waiting for file lock on build directory
    Checking rspotify v0.10.0 (/home/mario/Programming/rspotify)
error: item name starts with its containing module's name
  --> src/client.rs:24:1
   |
24 | / pub enum ClientError {
25 | |     /// Raised when the authentication isn't configured properly.
26 | |     #[error("invalid client authentication: {0}")]
27 | |     InvalidAuth(String),
...  |
58 | |     CacheFile(String),
59 | | }
   | |_^
   |
   = note: `-D clippy::module-name-repetitions` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/client.rs:61:1
   |
61 | pub type ClientResult<T> = Result<T, ClientError>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: integer type suffix should be separated by an underscore
    --> src/client.rs:1934:29
     |
1934 |         if volume_percent > 100u8 {
     |                             ^^^^^ help: add an underscore: `100_u8`
     |
     = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unseparated_literal_suffix

error: unnested or-patterns
  --> src/http/reqwest.rs:24:13
   |
24 |             status @ StatusCode::FORBIDDEN | status @ StatusCode::NOT_FOUND => response
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::unnested-or-patterns` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
   |
24 |             status @ (StatusCode::FORBIDDEN | StatusCode::NOT_FOUND) => response
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: item name starts with its containing module's name
  --> src/http/reqwest.rs:50:1
   |
50 | / pub struct ReqwestClient {
51 | |     /// reqwest needs an instance of its client to perform requests.
52 | |     client: reqwest::Client,
53 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: unnecessary boolean `not` operation
   --> src/http/mod.rs:129:9
    |
129 | /         if !url.starts_with("http") {
130 | |             self.prefix.clone() + url
131 | |         } else {
132 | |             url.to_string()
133 | |         }
    | |_________^
    |
    = note: `-D clippy::if-not-else` implied by `-D warnings`
    = help: remove the `!` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else

error: item name ends with its containing module's name
  --> src/model/album.rs:19:1
   |
19 | / pub struct SimplifiedAlbum {
20 | |     #[serde(skip_serializing_if = "Option::is_none")]
21 | |     pub album_group: Option<String>,
22 | |     pub album_type: Option<String>,
...  |
39 | |     pub uri: Option<String>,
40 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/album.rs:46:1
   |
46 | / pub struct FullAlbum {
47 | |     pub artists: Vec<SimplifiedArtist>,
48 | |     pub album_type: AlbumType,
49 | |     pub available_markets: Vec<String>,
...  |
64 | |     pub uri: String,
65 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/album.rs:87:1
   |
87 | / pub struct SavedAlbum {
88 | |     pub added_at: DateTime<Utc>,
89 | |     pub album: FullAlbum,
90 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/artist.rs:14:1
   |
14 | / pub struct SimplifiedArtist {
15 | |     pub external_urls: HashMap<String, String>,
16 | |     pub href: Option<String>,
17 | |     pub id: Option<String>,
...  |
21 | |     pub uri: Option<String>,
22 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/artist.rs:28:1
   |
28 | / pub struct FullArtist {
29 | |     pub external_urls: HashMap<String, String>,
30 | |     pub followers: Followers,
31 | |     pub genres: Vec<String>,
...  |
39 | |     pub uri: String,
40 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/audio.rs:11:1
   |
11 | / pub struct AudioFeatures {
12 | |     pub acousticness: f32,
13 | |     pub analysis_url: String,
14 | |     pub danceability: f32,
...  |
32 | |     pub valence: f32,
33 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/audio.rs:47:1
   |
47 | / pub struct AudioAnalysis {
48 | |     pub bars: Vec<TimeInterval>,
49 | |     pub beats: Vec<TimeInterval>,
50 | |     pub meta: AudioAnalysisMeta,
...  |
54 | |     pub track: AudioAnalysisTrack,
55 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/audio.rs:70:1
   |
70 | / pub struct AudioAnalysisSection {
71 | |     #[serde(flatten)]
72 | |     pub time_interval: TimeInterval,
73 | |     pub loudness: f32,
...  |
82 | |     pub time_signature_confidence: f32,
83 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/audio.rs:89:1
   |
89 | / pub struct AudioAnalysisMeta {
90 | |     pub analyzer_version: String,
91 | |     pub platform: String,
92 | |     pub detailed_status: String,
...  |
96 | |     pub input_process: String,
97 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
   --> src/model/audio.rs:103:1
    |
103 | / pub struct AudioAnalysisSegment {
104 | |     #[serde(flatten)]
105 | |     pub time_interval: TimeInterval,
106 | |     pub loudness_start: f32,
...   |
111 | |     pub timbre: Vec<f32>,
112 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
   --> src/model/audio.rs:118:1
    |
118 | / pub struct AudioAnalysisTrack {
119 | |     pub num_samples: u32,
120 | |     pub duration: f32,
121 | |     pub sample_md5: String,
...   |
145 | |     pub rhythm_version: f32,
146 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/context.rs:29:1
   |
29 | / pub struct CurrentlyPlayingContext {
30 | |     pub context: Option<Context>,
31 | |     #[serde(with = "millisecond_timestamp")]
32 | |     pub timestamp: DateTime<Utc>,
...  |
39 | |     pub actions: Actions,
40 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/context.rs:43:1
   |
43 | / pub struct CurrentPlaybackContext {
44 | |     pub device: Device,
45 | |     pub repeat_state: RepeatState,
46 | |     pub shuffle_state: bool,
...  |
56 | |     pub actions: Actions,
57 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: all variants have the same postfix: `Term`
  --> src/model/enums/misc.rs:33:1
   |
33 | / pub enum TimeRange {
34 | |     LongTerm,
35 | |     MediumTerm,
36 | |     ShortTerm,
37 | | }
   | |_^
   |
   = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings`
   = help: remove the postfixes and use full paths to the variants instead of glob imports
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names

error: using a potentially dangerous silent `as` conversion
  --> src/model/idtypes.rs:95:21
   |
95 |         unsafe { &*(&*self.id as *const str as *const Id<T>) }
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::as-conversions` implied by `-D warnings`
   = help: consider using a safe wrapper for this conversion
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: using a potentially dangerous silent `as` conversion
  --> src/model/idtypes.rs:95:21
   |
95 |         unsafe { &*(&*self.id as *const str as *const Id<T>) }
   |                     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using a safe wrapper for this conversion
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: all variants have the same prefix: `Invalid`
   --> src/model/idtypes.rs:139:1
    |
139 | / pub enum IdError {
140 | |     /// Spotify URI prefix is not `spotify:` or `spotify/`
141 | |     InvalidPrefix,
142 | |     /// Spotify URI can't be split into type and id parts
...   |
149 | |     InvalidId,
150 | | }
    | |_^
    |
    = help: remove the prefixes and use full paths to the variants instead of glob imports
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names

error: using a potentially dangerous silent `as` conversion
   --> src/model/idtypes.rs:258:28
    |
258 |             Ok(unsafe { &*(id as *const str as *const Id<T>) })
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider using a safe wrapper for this conversion
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: using a potentially dangerous silent `as` conversion
   --> src/model/idtypes.rs:258:28
    |
258 |             Ok(unsafe { &*(id as *const str as *const Id<T>) })
    |                            ^^^^^^^^^^^^^^^^
    |
    = help: consider using a safe wrapper for this conversion
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: item name ends with its containing module's name
  --> src/model/page.rs:23:1
   |
23 | / pub struct CursorBasedPage<T> {
24 | |     pub href: String,
25 | |     pub items: Vec<T>,
26 | |     pub limit: u32,
...  |
31 | |     pub total: Option<u32>,
32 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/playlist.rs:16:1
   |
16 | / pub struct PlaylistResult {
17 | |     pub snapshot_id: String,
18 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/playlist.rs:24:1
   |
24 | / pub struct PlaylistTracksRef {
25 | |     pub href: String,
26 | |     pub total: u32,
27 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/playlist.rs:33:1
   |
33 | / pub struct SimplifiedPlaylist {
34 | |     pub collaborative: bool,
35 | |     pub external_urls: HashMap<String, String>,
36 | |     pub href: String,
...  |
46 | |     pub uri: String,
47 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/playlist.rs:53:1
   |
53 | / pub struct FullPlaylist {
54 | |     pub collaborative: bool,
55 | |     pub description: String,
56 | |     pub external_urls: HashMap<String, String>,
...  |
68 | |     pub uri: String,
69 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/playlist.rs:75:1
   |
75 | / pub struct PlaylistItem {
76 | |     pub added_at: Option<DateTime<Utc>>,
77 | |     pub added_by: Option<PublicUser>,
78 | |     pub is_local: bool,
79 | |     pub track: Option<PlayableItem>,
80 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:15:1
   |
15 | / pub struct SearchPlaylists {
16 | |     pub playlists: Page<SimplifiedPlaylist>,
17 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:23:1
   |
23 | / pub struct SearchAlbums {
24 | |     pub albums: Page<SimplifiedAlbum>,
25 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:31:1
   |
31 | / pub struct SearchArtists {
32 | |     pub artists: Page<FullArtist>,
33 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:37:1
   |
37 | / pub struct SearchTracks {
38 | |     pub tracks: Page<FullTrack>,
39 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:45:1
   |
45 | / pub struct SearchShows {
46 | |     pub shows: Page<SimplifiedShow>,
47 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:53:1
   |
53 | / pub struct SearchEpisodes {
54 | |     pub episodes: Page<SimplifiedEpisode>,
55 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/search.rs:61:1
   |
61 | / pub enum SearchResult {
62 | |     #[serde(rename = "playlists")]
63 | |     Playlists(Page<SimplifiedPlaylist>),
64 | |     #[serde(rename = "albums")]
...  |
73 | |     Episodes(Page<SimplifiedEpisode>),
74 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/show.rs:22:1
   |
22 | / pub struct SimplifiedShow {
23 | |     pub available_markets: Vec<String>,
24 | |     pub copyrights: Vec<Copyright>,
25 | |     pub description: String,
...  |
38 | |     pub uri: String,
39 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/show.rs:62:1
   |
62 | / pub struct FullShow {
63 | |     pub available_markets: Vec<String>,
64 | |     pub copyrights: Vec<Copyright>,
65 | |     pub description: String,
...  |
79 | |     pub uri: String,
80 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/track.rs:17:1
   |
17 | / pub struct FullTrack {
18 | |     pub album: SimplifiedAlbum,
19 | |     pub artists: Vec<SimplifiedArtist>,
20 | |     #[serde(skip_serializing_if = "Vec::is_empty", default)]
...  |
43 | |     pub uri: String,
44 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
  --> src/model/track.rs:50:1
   |
50 | / pub struct TrackLink {
51 | |     pub external_urls: HashMap<String, String>,
52 | |     pub href: String,
53 | |     pub id: String,
...  |
56 | |     pub uri: String,
57 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/track.rs:74:1
   |
74 | / pub struct SimplifiedTrack {
75 | |     pub artists: Vec<SimplifiedArtist>,
76 | |     pub available_markets: Option<Vec<String>>,
77 | |     pub disc_number: i32,
...  |
94 | |     pub uri: String,
95 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
   --> src/model/track.rs:101:1
    |
101 | / pub struct SavedTrack {
102 | |     pub added_at: DateTime<Utc>,
103 | |     pub track: FullTrack,
104 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name starts with its containing module's name
   --> src/model/track.rs:107:1
    |
107 | / pub struct TrackPositions<'id> {
108 | |     pub id: &'id TrackId,
109 | |     pub positions: Vec<u32>,
110 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/user.rs:14:1
   |
14 | / pub struct PublicUser {
15 | |     pub display_name: Option<String>,
16 | |     pub external_urls: HashMap<String, String>,
17 | |     pub followers: Option<Followers>,
...  |
24 | |     pub uri: String,
25 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/model/user.rs:31:1
   |
31 | / pub struct PrivateUser {
32 | |     pub country: Option<Country>,
33 | |     pub display_name: Option<String>,
34 | |     pub email: Option<String>,
...  |
44 | |     pub uri: String,
45 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: using a potentially dangerous silent `as` conversion
  --> src/model/mod.rs:59:25
   |
59 |         s.serialize_u64(x.as_millis() as u64)
   |                         ^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using a safe wrapper for this conversion
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: using a potentially dangerous silent `as` conversion
  --> src/model/mod.rs:87:30
   |
87 |             let nanosecond = ((v % 1000) * 1000000) as u32;
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider using a safe wrapper for this conversion
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: long literal lacking separators
  --> src/model/mod.rs:87:44
   |
87 |             let nanosecond = ((v % 1000) * 1000000) as u32;
   |                                            ^^^^^^^ help: consider: `1_000_000`
   |
   = note: `-D clippy::unreadable-literal` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal

error: using a potentially dangerous silent `as` conversion
  --> src/model/mod.rs:91:47
   |
91 |                 NaiveDateTime::from_timestamp(second as i64, nanosecond),
   |                                               ^^^^^^^^^^^^^
   |
   = help: consider using a safe wrapper for this conversion
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: using a potentially dangerous silent `as` conversion
   --> src/model/mod.rs:167:47
    |
167 |             Some(duration) => s.serialize_u64(duration.as_millis() as u64),
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider using a safe wrapper for this conversion
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: integer type suffix should be separated by an underscore
   --> src/lib.rs:205:24
    |
205 |     let mut buf = vec![0u8; length];
    |                        ^^^ help: add an underscore: `0_u8`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unseparated_literal_suffix

error: using a potentially dangerous silent `as` conversion
   --> src/lib.rs:210:21
    |
210 |         .map(|byte| alphanum[*byte as usize % range] as char)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider using a safe wrapper for this conversion
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: using a potentially dangerous silent `as` conversion
   --> src/lib.rs:210:30
    |
210 |         .map(|byte| alphanum[*byte as usize % range] as char)
    |                              ^^^^^^^^^^^^^^
    |
    = help: consider using a safe wrapper for this conversion
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions

error: aborting due to 55 previous errors

error: could not compile `rspotify`

To learn more, run the command again with --verbose.

What do you think? None of these are really important, so no rush.

Originally created by @marioortizmanero on GitHub (Apr 20, 2021). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/204 **Is your feature request related to a problem? Please describe.** I just learned about the more "extreme" clippy lints, which can be enabled by adding this to the header of `lib.rs`: ```rust #![warn( clippy::all, clippy::restriction, clippy::pedantic, clippy::nursery, clippy::cargo, )] ``` They are "extreme" for a reason; it might not be a good idea to have them always enabled because they can be annoying/wrong, but I think it's a good idea to try it out from time to time and consider its suggestions in a discussion like this. Here's a summary of the lints it found: 1. [unnested-or-patterns](https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns): simplifying `or` patterns in `match` expressions. 2. [unseparated-literal-suffix](https://rust-lang.github.io/rust-clippy/master/index.html#unseparated_literal_suffix): `100_u8` might look more readable than `100u8`, but 3. [module-name-repetitions](https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions): Some names are repetitive. For example one user might use `rspotify::client` and then access its items with `client::`, but that would be repetitive in cases like `ClientError` or `ClientResult`, which would look like `client::ClientError`. This also includes cases like `album::SimplifiedAlbum`, which are more complicated because we try to follow the same Spotify names. 4. [if-not-else](https://rust-lang.github.io/rust-clippy/master/index.html#if-not-else): avoiding unnecessary `!` might make code more readable. 5. [pub_enum_variant_names](https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names): if every variant in an enum has a word, we might as well move it to the enum's name itself or just remove them. 6. [as_conversions](https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions): `as` conversions that might lose data. Note that most of them aren't rally necessary, including the unsafe transformation for `Id`, about which there's not much else to do. 7. [unreadable_literal](https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal): using `_` digit separators; `1_000_000` is more readable than `1000000`. You can find examples of the lints I mentioned by searching in the following log: <details> <summary>Full output for `default` branch</summary> ``` ❯ cargo clippy --all -- -D warnings Blocking waiting for file lock on build directory Checking rspotify v0.10.0 (/home/mario/Programming/rspotify) error: item name starts with its containing module's name --> src/client.rs:24:1 | 24 | / pub enum ClientError { 25 | | /// Raised when the authentication isn't configured properly. 26 | | #[error("invalid client authentication: {0}")] 27 | | InvalidAuth(String), ... | 58 | | CacheFile(String), 59 | | } | |_^ | = note: `-D clippy::module-name-repetitions` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/client.rs:61:1 | 61 | pub type ClientResult<T> = Result<T, ClientError>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: integer type suffix should be separated by an underscore --> src/client.rs:1934:29 | 1934 | if volume_percent > 100u8 { | ^^^^^ help: add an underscore: `100_u8` | = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unseparated_literal_suffix error: unnested or-patterns --> src/http/reqwest.rs:24:13 | 24 | status @ StatusCode::FORBIDDEN | status @ StatusCode::NOT_FOUND => response | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnested-or-patterns` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns help: nest the patterns | 24 | status @ (StatusCode::FORBIDDEN | StatusCode::NOT_FOUND) => response | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: item name starts with its containing module's name --> src/http/reqwest.rs:50:1 | 50 | / pub struct ReqwestClient { 51 | | /// reqwest needs an instance of its client to perform requests. 52 | | client: reqwest::Client, 53 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: unnecessary boolean `not` operation --> src/http/mod.rs:129:9 | 129 | / if !url.starts_with("http") { 130 | | self.prefix.clone() + url 131 | | } else { 132 | | url.to_string() 133 | | } | |_________^ | = note: `-D clippy::if-not-else` implied by `-D warnings` = help: remove the `!` and swap the blocks of the `if`/`else` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else error: item name ends with its containing module's name --> src/model/album.rs:19:1 | 19 | / pub struct SimplifiedAlbum { 20 | | #[serde(skip_serializing_if = "Option::is_none")] 21 | | pub album_group: Option<String>, 22 | | pub album_type: Option<String>, ... | 39 | | pub uri: Option<String>, 40 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/album.rs:46:1 | 46 | / pub struct FullAlbum { 47 | | pub artists: Vec<SimplifiedArtist>, 48 | | pub album_type: AlbumType, 49 | | pub available_markets: Vec<String>, ... | 64 | | pub uri: String, 65 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/album.rs:87:1 | 87 | / pub struct SavedAlbum { 88 | | pub added_at: DateTime<Utc>, 89 | | pub album: FullAlbum, 90 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/artist.rs:14:1 | 14 | / pub struct SimplifiedArtist { 15 | | pub external_urls: HashMap<String, String>, 16 | | pub href: Option<String>, 17 | | pub id: Option<String>, ... | 21 | | pub uri: Option<String>, 22 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/artist.rs:28:1 | 28 | / pub struct FullArtist { 29 | | pub external_urls: HashMap<String, String>, 30 | | pub followers: Followers, 31 | | pub genres: Vec<String>, ... | 39 | | pub uri: String, 40 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:11:1 | 11 | / pub struct AudioFeatures { 12 | | pub acousticness: f32, 13 | | pub analysis_url: String, 14 | | pub danceability: f32, ... | 32 | | pub valence: f32, 33 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:47:1 | 47 | / pub struct AudioAnalysis { 48 | | pub bars: Vec<TimeInterval>, 49 | | pub beats: Vec<TimeInterval>, 50 | | pub meta: AudioAnalysisMeta, ... | 54 | | pub track: AudioAnalysisTrack, 55 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:70:1 | 70 | / pub struct AudioAnalysisSection { 71 | | #[serde(flatten)] 72 | | pub time_interval: TimeInterval, 73 | | pub loudness: f32, ... | 82 | | pub time_signature_confidence: f32, 83 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:89:1 | 89 | / pub struct AudioAnalysisMeta { 90 | | pub analyzer_version: String, 91 | | pub platform: String, 92 | | pub detailed_status: String, ... | 96 | | pub input_process: String, 97 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:103:1 | 103 | / pub struct AudioAnalysisSegment { 104 | | #[serde(flatten)] 105 | | pub time_interval: TimeInterval, 106 | | pub loudness_start: f32, ... | 111 | | pub timbre: Vec<f32>, 112 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/audio.rs:118:1 | 118 | / pub struct AudioAnalysisTrack { 119 | | pub num_samples: u32, 120 | | pub duration: f32, 121 | | pub sample_md5: String, ... | 145 | | pub rhythm_version: f32, 146 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/context.rs:29:1 | 29 | / pub struct CurrentlyPlayingContext { 30 | | pub context: Option<Context>, 31 | | #[serde(with = "millisecond_timestamp")] 32 | | pub timestamp: DateTime<Utc>, ... | 39 | | pub actions: Actions, 40 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/context.rs:43:1 | 43 | / pub struct CurrentPlaybackContext { 44 | | pub device: Device, 45 | | pub repeat_state: RepeatState, 46 | | pub shuffle_state: bool, ... | 56 | | pub actions: Actions, 57 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: all variants have the same postfix: `Term` --> src/model/enums/misc.rs:33:1 | 33 | / pub enum TimeRange { 34 | | LongTerm, 35 | | MediumTerm, 36 | | ShortTerm, 37 | | } | |_^ | = note: `-D clippy::pub-enum-variant-names` implied by `-D warnings` = help: remove the postfixes and use full paths to the variants instead of glob imports = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names error: using a potentially dangerous silent `as` conversion --> src/model/idtypes.rs:95:21 | 95 | unsafe { &*(&*self.id as *const str as *const Id<T>) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::as-conversions` implied by `-D warnings` = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: using a potentially dangerous silent `as` conversion --> src/model/idtypes.rs:95:21 | 95 | unsafe { &*(&*self.id as *const str as *const Id<T>) } | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: all variants have the same prefix: `Invalid` --> src/model/idtypes.rs:139:1 | 139 | / pub enum IdError { 140 | | /// Spotify URI prefix is not `spotify:` or `spotify/` 141 | | InvalidPrefix, 142 | | /// Spotify URI can't be split into type and id parts ... | 149 | | InvalidId, 150 | | } | |_^ | = help: remove the prefixes and use full paths to the variants instead of glob imports = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_enum_variant_names error: using a potentially dangerous silent `as` conversion --> src/model/idtypes.rs:258:28 | 258 | Ok(unsafe { &*(id as *const str as *const Id<T>) }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: using a potentially dangerous silent `as` conversion --> src/model/idtypes.rs:258:28 | 258 | Ok(unsafe { &*(id as *const str as *const Id<T>) }) | ^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: item name ends with its containing module's name --> src/model/page.rs:23:1 | 23 | / pub struct CursorBasedPage<T> { 24 | | pub href: String, 25 | | pub items: Vec<T>, 26 | | pub limit: u32, ... | 31 | | pub total: Option<u32>, 32 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/playlist.rs:16:1 | 16 | / pub struct PlaylistResult { 17 | | pub snapshot_id: String, 18 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/playlist.rs:24:1 | 24 | / pub struct PlaylistTracksRef { 25 | | pub href: String, 26 | | pub total: u32, 27 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/playlist.rs:33:1 | 33 | / pub struct SimplifiedPlaylist { 34 | | pub collaborative: bool, 35 | | pub external_urls: HashMap<String, String>, 36 | | pub href: String, ... | 46 | | pub uri: String, 47 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/playlist.rs:53:1 | 53 | / pub struct FullPlaylist { 54 | | pub collaborative: bool, 55 | | pub description: String, 56 | | pub external_urls: HashMap<String, String>, ... | 68 | | pub uri: String, 69 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/playlist.rs:75:1 | 75 | / pub struct PlaylistItem { 76 | | pub added_at: Option<DateTime<Utc>>, 77 | | pub added_by: Option<PublicUser>, 78 | | pub is_local: bool, 79 | | pub track: Option<PlayableItem>, 80 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:15:1 | 15 | / pub struct SearchPlaylists { 16 | | pub playlists: Page<SimplifiedPlaylist>, 17 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:23:1 | 23 | / pub struct SearchAlbums { 24 | | pub albums: Page<SimplifiedAlbum>, 25 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:31:1 | 31 | / pub struct SearchArtists { 32 | | pub artists: Page<FullArtist>, 33 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:37:1 | 37 | / pub struct SearchTracks { 38 | | pub tracks: Page<FullTrack>, 39 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:45:1 | 45 | / pub struct SearchShows { 46 | | pub shows: Page<SimplifiedShow>, 47 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:53:1 | 53 | / pub struct SearchEpisodes { 54 | | pub episodes: Page<SimplifiedEpisode>, 55 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/search.rs:61:1 | 61 | / pub enum SearchResult { 62 | | #[serde(rename = "playlists")] 63 | | Playlists(Page<SimplifiedPlaylist>), 64 | | #[serde(rename = "albums")] ... | 73 | | Episodes(Page<SimplifiedEpisode>), 74 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/show.rs:22:1 | 22 | / pub struct SimplifiedShow { 23 | | pub available_markets: Vec<String>, 24 | | pub copyrights: Vec<Copyright>, 25 | | pub description: String, ... | 38 | | pub uri: String, 39 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/show.rs:62:1 | 62 | / pub struct FullShow { 63 | | pub available_markets: Vec<String>, 64 | | pub copyrights: Vec<Copyright>, 65 | | pub description: String, ... | 79 | | pub uri: String, 80 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/track.rs:17:1 | 17 | / pub struct FullTrack { 18 | | pub album: SimplifiedAlbum, 19 | | pub artists: Vec<SimplifiedArtist>, 20 | | #[serde(skip_serializing_if = "Vec::is_empty", default)] ... | 43 | | pub uri: String, 44 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/track.rs:50:1 | 50 | / pub struct TrackLink { 51 | | pub external_urls: HashMap<String, String>, 52 | | pub href: String, 53 | | pub id: String, ... | 56 | | pub uri: String, 57 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/track.rs:74:1 | 74 | / pub struct SimplifiedTrack { 75 | | pub artists: Vec<SimplifiedArtist>, 76 | | pub available_markets: Option<Vec<String>>, 77 | | pub disc_number: i32, ... | 94 | | pub uri: String, 95 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/track.rs:101:1 | 101 | / pub struct SavedTrack { 102 | | pub added_at: DateTime<Utc>, 103 | | pub track: FullTrack, 104 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name starts with its containing module's name --> src/model/track.rs:107:1 | 107 | / pub struct TrackPositions<'id> { 108 | | pub id: &'id TrackId, 109 | | pub positions: Vec<u32>, 110 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/user.rs:14:1 | 14 | / pub struct PublicUser { 15 | | pub display_name: Option<String>, 16 | | pub external_urls: HashMap<String, String>, 17 | | pub followers: Option<Followers>, ... | 24 | | pub uri: String, 25 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: item name ends with its containing module's name --> src/model/user.rs:31:1 | 31 | / pub struct PrivateUser { 32 | | pub country: Option<Country>, 33 | | pub display_name: Option<String>, 34 | | pub email: Option<String>, ... | 44 | | pub uri: String, 45 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions error: using a potentially dangerous silent `as` conversion --> src/model/mod.rs:59:25 | 59 | s.serialize_u64(x.as_millis() as u64) | ^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: using a potentially dangerous silent `as` conversion --> src/model/mod.rs:87:30 | 87 | let nanosecond = ((v % 1000) * 1000000) as u32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: long literal lacking separators --> src/model/mod.rs:87:44 | 87 | let nanosecond = ((v % 1000) * 1000000) as u32; | ^^^^^^^ help: consider: `1_000_000` | = note: `-D clippy::unreadable-literal` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal error: using a potentially dangerous silent `as` conversion --> src/model/mod.rs:91:47 | 91 | NaiveDateTime::from_timestamp(second as i64, nanosecond), | ^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: using a potentially dangerous silent `as` conversion --> src/model/mod.rs:167:47 | 167 | Some(duration) => s.serialize_u64(duration.as_millis() as u64), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: integer type suffix should be separated by an underscore --> src/lib.rs:205:24 | 205 | let mut buf = vec![0u8; length]; | ^^^ help: add an underscore: `0_u8` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unseparated_literal_suffix error: using a potentially dangerous silent `as` conversion --> src/lib.rs:210:21 | 210 | .map(|byte| alphanum[*byte as usize % range] as char) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: using a potentially dangerous silent `as` conversion --> src/lib.rs:210:30 | 210 | .map(|byte| alphanum[*byte as usize % range] as char) | ^^^^^^^^^^^^^^ | = help: consider using a safe wrapper for this conversion = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions error: aborting due to 55 previous errors error: could not compile `rspotify` To learn more, run the command again with --verbose. ``` </details> What do you think? None of these are really important, so no rush.
kerem 2026-02-27 20:22:55 +03:00
Author
Owner

@marioortizmanero commented on GitHub (Apr 20, 2021):

My own opinion:

  1. I would definitely do that, I see no downside.
  2. Meh, sure.
  3. Very interesting. I would do it for ClientError and ClientResult, I've never been fond of the Client prefix in these cases, because we don't have another "global" error type anyway. But I would leave the models alone, let's just keep them as close as possible to the Spotify API.
  4. Sure.
  5. Maybe it could make sense for IdError, but not really sure.
  6. I don't think any of these are important, but let me know if I'm wrong.
  7. Sure.
<!-- gh-comment-id:823407217 --> @marioortizmanero commented on GitHub (Apr 20, 2021): My own opinion: 1. I would definitely do that, I see no downside. 2. Meh, sure. 3. Very interesting. I would do it for `ClientError` and `ClientResult`, I've never been fond of the `Client` prefix in these cases, because we don't have another "global" error type anyway. But I would leave the models alone, let's just keep them as close as possible to the Spotify API. 4. Sure. 5. Maybe it could make sense for `IdError`, but not really sure. 6. I don't think any of these are important, but let me know if I'm wrong. 7. Sure.
Author
Owner

@flip1995 commented on GitHub (Oct 5, 2021):

Hey, Clippy maintainer here. You shouldn't enable the restriction group as a whole. Clippy will even emit a warning if you do so. This is because lints in this group are allowed to contradict other lints in Clippy and the Clippy output is then just a unfixable mess.

nursery is for buggy/unfinished lints, so expect much noise from this group. I wouldn't recommend to enable this group, but if you want to help us test those lints, we wouldn't hold you back :).

pedantic is pedantic and you should expect many allows popping up in the code. Clippy uses the whole pedantic group to lint itself, so using it here should be fine, if you want Clippy to annoy help you with everything.

<!-- gh-comment-id:934211847 --> @flip1995 commented on GitHub (Oct 5, 2021): Hey, Clippy maintainer here. You shouldn't enable the `restriction` group as a whole. Clippy will even emit a warning if you do so. This is because lints in this group are allowed to contradict other lints in Clippy and the Clippy output is then just a unfixable mess. `nursery` is for buggy/unfinished lints, so expect much noise from this group. I wouldn't recommend to enable this group, but if you want to help us test those lints, we wouldn't hold you back :). `pedantic` is pedantic and you should expect many `allow`s popping up in the code. Clippy uses the whole `pedantic` group to lint itself, so using it here should be fine, if you want Clippy to ~~annoy~~ help you with everything.
Author
Owner

@marioortizmanero commented on GitHub (Dec 29, 2022):

We should do one last run before releasing v1.0.

@ramsayleung, I've added a milestone that includes the most important issues we need to address before releasing the first stable version. I haven't included stuff like #377 because these aren't breaking changes and can be implemented later on just fine. I'm mainly talking about issues that may involve re-designing parts of the library, so that we avoid such large breaking changes early on.

<!-- gh-comment-id:1367381193 --> @marioortizmanero commented on GitHub (Dec 29, 2022): We should do one last run before releasing v1.0. @ramsayleung, I've added a milestone that includes the most important issues we need to address before releasing the first stable version. I haven't included stuff like #377 because these aren't breaking changes and can be implemented later on just fine. I'm mainly talking about issues that may involve re-designing parts of the library, so that we avoid such large breaking changes early on.
Author
Owner

@flip1995 commented on GitHub (Dec 30, 2022):

If you want to do a release, then you should consider setting the avoid-breaking-exported-api to false, which will enable additional behavior for some lints. You can do so by adding a clippy.toml file and put

avoid_breaking_exported_api: false

there.

You shouldn't keep this enabled in CI/after v1.0.

<!-- gh-comment-id:1367992997 --> @flip1995 commented on GitHub (Dec 30, 2022): If you want to do a release, then you should consider setting the [`avoid-breaking-exported-api`](https://rust-lang.github.io/rust-clippy/master/index.html#avoid-breaking-exported-api) to `false`, which will enable additional behavior for some lints. You can do so by adding a `clippy.toml` file and put ```toml avoid_breaking_exported_api: false ``` there. You shouldn't keep this enabled in CI/after v1.0.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 4, 2023):

Message to comment on stale issues. If none provided, will not mark issues stale

<!-- gh-comment-id:1619386307 --> @github-actions[bot] commented on GitHub (Jul 4, 2023): Message to comment on stale issues. If none provided, will not mark issues stale
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#67
No description provided.