Skip to content

Commit a37f7f0

Browse files
committed
Enable rust_2024_compatibility lints
...and by the way fix the lint priority in Cargo.toml.
1 parent 7337653 commit a37f7f0

File tree

20 files changed

+42
-58
lines changed

20 files changed

+42
-58
lines changed

Cargo.toml

+9-5
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,21 @@ url = "2.5.4"
6868
[workspace.lints.rust]
6969
# Opt-in for allowed-by-default lints (in alphabetical order)
7070
# See also: <https://doc.rust-lang.org/rustc/lints>
71-
future_incompatible = "warn"
72-
let_underscore = "warn"
71+
future_incompatible = { level = "warn", priority = -1 }
72+
let_underscore = { level = "warn", priority = -1 }
7373
missing_debug_implementations = "warn"
74-
rust_2018_idioms = "warn"
75-
rust_2021_compatibility = "warn"
74+
rust_2018_idioms = { level = "warn", priority = -1 }
75+
rust_2021_compatibility = { level = "warn", priority = -1 }
76+
rust_2024_compatibility = { level = "warn", priority = -1 }
7677
unreachable_pub = "warn"
7778
unsafe_code = "warn"
7879
unused = "warn"
80+
# Accept changed behavior in 2024 edition regarding temporary lifetimes and drop order.
81+
if_let_rescope = "allow"
82+
tail_expr_drop_order = "allow"
7983

8084
[workspace.lints.clippy]
81-
pedantic = "warn"
85+
pedantic = { level = "warn", priority = -1 }
8286

8387
# Workaround for <https://github.com/rust-lang/rust-clippy/issues/12270>
8488
lint_groups_priority = "allow"

crates/backend-webapi-json/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::wildcard_imports)]
7-
84
use std::result::Result as StdResult;
95

106
use diesel::Connection as _;

crates/core-api-json/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::wildcard_imports)]
7-
84
#[cfg(not(any(feature = "frontend", feature = "backend")))]
95
compile_error!("at least one of the features \"frontend\" or \"backend\" must be enabled");
106

crates/core-json/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::wildcard_imports)]
7-
84
pub mod prelude {
95
pub(crate) use serde::{Deserialize, Serialize};
106
pub(crate) use serde_repr::*;

crates/core-json/src/util/clock/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ impl schemars::JsonSchema for YyyyMmDdDate {
7777
"YyyyMmDdDate".to_string()
7878
}
7979

80-
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
81-
gen.subschema_for::<YyyyMmDdDateValue>()
80+
fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
81+
r#gen.subschema_for::<YyyyMmDdDateValue>()
8282
}
8383
}
8484

crates/core-json/src/util/color/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ impl schemars::JsonSchema for RgbColor {
6565
"RgbColor".to_string()
6666
}
6767

68-
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
68+
fn json_schema(r#gen: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
6969
use schemars::schema::Schema;
70-
let mut schema = gen.subschema_for::<String>();
70+
let mut schema = r#gen.subschema_for::<String>();
7171
if let Schema::Object(mut schema_object) = schema {
7272
schema_object.metadata().title = Some("RGB color code".into());
7373
schema_object.metadata().description = Some(

crates/core/src/audio/channel/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ impl Validate for Channels {
229229
fn validate(&self) -> ValidationResult<Self::Invalidity> {
230230
let context = ValidationContext::new();
231231
match self {
232-
Channels::Count(ref count) => context.validate_with(count, Self::Invalidity::Count),
233-
Channels::Flags(ref flags) => context.validate_with(flags, Self::Invalidity::Flags),
232+
Channels::Count(count) => context.validate_with(count, Self::Invalidity::Count),
233+
Channels::Flags(flags) => context.validate_with(flags, Self::Invalidity::Flags),
234234
}
235235
.into()
236236
}

crates/core/src/media/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Validate for Source {
120120
.validate_with(&artwork, Self::Invalidity::Artwork);
121121
// TODO: Validate MIME type
122122
match content_metadata {
123-
ContentMetadata::Audio(ref audio_content) => {
123+
ContentMetadata::Audio(audio_content) => {
124124
context.validate_with(audio_content, Self::Invalidity::AudioContentMetadata)
125125
}
126126
}

crates/core/src/playlist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Validate for Item {
7979
let context = ValidationContext::new();
8080
match self {
8181
Item::Separator(_) => context,
82-
Item::Track(ref track) => context.validate_with(track, Self::Invalidity::Track),
82+
Item::Track(track) => context.validate_with(track, Self::Invalidity::Track),
8383
}
8484
.into()
8585
}

crates/core/src/track/title/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl Titles {
144144
titles.into_iter().find(|title| !title.name.is_empty())
145145
}
146146

147-
pub fn main_titles<'a, 'b, I>(titles: I) -> impl Iterator<Item = &'a Title>
147+
pub fn main_titles<'a, 'b, I>(titles: I) -> impl Iterator<Item = &'a Title> + use<'a, I>
148148
where
149149
I: IntoIterator<Item = &'a Title>,
150150
{
@@ -165,7 +165,7 @@ impl Titles {
165165
Self::first_non_empty_name(Self::filter_kind(titles, kind))
166166
}
167167

168-
pub fn sorting_titles<'a, 'b, I>(titles: I) -> impl Iterator<Item = &'a Title>
168+
pub fn sorting_titles<'a, 'b, I>(titles: I) -> impl Iterator<Item = &'a Title> + use<'a, I>
169169
where
170170
I: IntoIterator<Item = &'a Title>,
171171
{

crates/desktop-app/src/collection/tasklet.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn on_settings_state_changed(
9595
settings: &Arc<settings::SharedState>,
9696
restore_entity: RestoreEntityStrategy,
9797
nested_music_directories: NestedMusicDirectoriesStrategy,
98-
) -> impl Future<Output = ()> + Send + 'static {
98+
) -> impl Future<Output = ()> + Send + 'static + use<> {
9999
let mut settings_subscriber = settings.subscribe_changed();
100100
let settings = Arc::downgrade(settings);
101101
async move {

crates/desktop-app/src/settings/tasklet.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ use super::State;
1212
/// Save the settings after changed.
1313
///
1414
/// The current settings at the time of invocation are not saved.
15-
pub fn on_state_changed_save_to_file(
15+
pub fn on_state_changed_save_to_file<E>(
1616
this: &Observer<State>,
1717
settings_dir: PathBuf,
18-
mut report_error: impl FnMut(anyhow::Error) + Send + 'static,
19-
) -> impl Future<Output = ()> + Send + 'static {
18+
mut report_error: E,
19+
) -> impl Future<Output = ()> + Send + 'static + use<E>
20+
where
21+
E: FnMut(anyhow::Error) + Send + 'static,
22+
{
2023
// Read and acknowledge the initial settings immediately before spawning
2124
// the async task. These are supposed to be saved already. Only subsequent
2225
// changes will be captured, which might occur already while spawning the task.
@@ -56,10 +59,13 @@ pub fn on_state_changed_save_to_file(
5659
}
5760

5861
/// Listen for changes of the music directory.
59-
pub fn on_music_dir_changed(
62+
pub fn on_music_dir_changed<C>(
6063
this: &Observer<State>,
61-
mut on_changed: impl FnMut(Option<&DirPath<'_>>) -> OnChanged + Send + 'static,
62-
) -> impl Future<Output = ()> + Send + 'static {
64+
mut on_changed: C,
65+
) -> impl Future<Output = ()> + Send + 'static + use<C>
66+
where
67+
C: FnMut(Option<&DirPath<'_>>) -> OnChanged + Send + 'static,
68+
{
6369
// Read the initial value immediately before spawning the async task
6470
let mut subscriber = this.subscribe();
6571
let mut value = subscriber

crates/desktop-app/src/track/repo_search/tasklet.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn on_should_prefetch(
5252
env: Weak<Environment>,
5353
this: &Arc<SharedState>,
5454
prefetch_limit: Option<NonZeroUsize>,
55-
) -> impl Future<Output = ()> + Send + 'static {
55+
) -> impl Future<Output = ()> + Send + 'static + use<> {
5656
let subscriber = this.subscribe_changed();
5757
let this = Arc::downgrade(this);
5858
async move {
@@ -82,7 +82,7 @@ pub fn on_should_prefetch(
8282
pub fn on_collection_state_changed(
8383
collection_state: &collection::SharedState,
8484
this: Weak<SharedState>,
85-
) -> impl Future<Output = ()> + Send + 'static {
85+
) -> impl Future<Output = ()> + Send + 'static + use<> {
8686
let mut collection_state_sub = collection_state.subscribe_changed();
8787
async move {
8888
log::debug!("Starting on_collection_state_changed");

crates/media-file/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::wildcard_imports)]
7-
84
pub mod fmt;
95
pub mod fs;
106
pub mod io;

crates/repo-sqlite/src/db/media_source/models.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'a> InsertableRecord<'a> {
278278
} = created_source;
279279
let audio_metadata = {
280280
match content_metadata {
281-
ContentMetadata::Audio(ref audio_metadata) => Some(audio_metadata),
281+
ContentMetadata::Audio(audio_metadata) => Some(audio_metadata),
282282
}
283283
};
284284
let (artwork_source, artwork_uri, artwork_image) =
@@ -424,7 +424,7 @@ impl<'a> UpdatableRecord<'a> {
424424
} = updated_source;
425425
let audio_metadata = {
426426
match content_metadata {
427-
ContentMetadata::Audio(ref audio_metadata) => Some(audio_metadata),
427+
ContentMetadata::Audio(audio_metadata) => Some(audio_metadata),
428428
}
429429
};
430430
let (artwork_source, artwork_uri, artwork_image) =

crates/repo-sqlite/src/lib.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// Suppress warnings for diesel AsChangeset
5-
#![allow(clippy::ref_option_ref)]
6-
// TODO: Remove temporary workaround.
7-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
4+
// These casts are needed for conversions from/to SQL types.
85
#![allow(clippy::cast_possible_wrap)]
9-
#![allow(clippy::wildcard_imports)]
6+
// Suppress warnings for diesel AsChangeset.
7+
#![allow(clippy::ref_option_ref)]
108

119
use std::ops::{Deref, DerefMut};
1210

crates/repo-sqlite/src/repo/track/search/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ fn select_track_ids_matching_tag_filter(
998998
} = filter;
999999

10001000
// Filter tag facet(s)
1001-
if let Some(ref filter) = facets {
1001+
if let Some(filter) = facets {
10021002
match filter {
10031003
FacetsFilter::Prefix(prefix) => {
10041004
let prefix = prefix.as_str();
@@ -1059,7 +1059,7 @@ fn select_track_ids_matching_tag_filter(
10591059
}
10601060

10611061
// Filter tag labels
1062-
if let Some(ref label) = label {
1062+
if let Some(label) = label {
10631063
if let Some((val, cmp, dir)) = decompose_string_predicate(label) {
10641064
let string_cmp_op = match cmp {
10651065
// Equal comparison without escape characters

crates/usecases-sqlite/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::similar_names)]
7-
84
use thiserror::Error;
95

106
use aoide_media_file::Error as MediaFileError;

crates/usecases/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (C) 2018-2024 Uwe Klotz <uwedotklotzatgmaildotcom> et al.
22
// SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
// TODO: Remove temporary workaround.
5-
// <https://github.com/rust-lang/rust-clippy/issues/11237>
6-
#![allow(clippy::similar_names)]
7-
84
use std::result::Result as StdResult;
95

106
use thiserror::Error;

websrv/src/routing/api.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(crate) fn create_filters(
5252
rt: &tokio::runtime::Handle,
5353
shared_connection_gatekeeper: Arc<DatabaseConnectionGatekeeper>,
5454
abort_flag: Arc<AtomicBool>,
55-
) -> BoxedFilter<(impl Reply,)> {
55+
) -> BoxedFilter<(impl Reply + use<>,)> {
5656
// The trailing comma is required!
5757
let shared_connection_gatekeeper =
5858
warp::any().map(move || Arc::clone(&shared_connection_gatekeeper));

0 commit comments

Comments
 (0)