Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoist lints from individual packages to workspace #336

Open
wants to merge 21 commits into
base: dev-0.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,32 @@ members = [
"symphonia-play",
"symphonia-check",
]

[workspace.lints.rust]
rust_2018_idioms = { level = "warn", priority = -1 }
unsafe_code = "forbid"
deprecated-safe = "forbid"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }

[workspace.lints.clippy]
# Justification:
# Where possible, expressing an algorithm as closely as possible to the specification is
# preferrable. Rewriting using range syntax provides marginal benefit, but could be confusing.
manual_range_contains = "allow"

# Justification:
# There is a performance penalty associated with the recommended idiom.
comparison_chain = "allow"

# Justification:
# Floating point constants provided by specifications and papers often provide extra digits that
# are truncated when using 32-bit floating point airthmetic. By keeping this precision, we can use
# the values provided directly & without modification, and, when investigating accuracy issues,
# we can easily switch to 64-bit floating point arithmetic and benefit from the higher precision.
excessive_precision = "allow"

# Justification:
# Sometimes the base or initial case of an unrolled multi-iteration/step mathematical expression
# contains operations that are otherwise no-ops. Disable the warning for these expressions because
# they're instructive to the reader and improve the code aesthetics.
identity_op = "allow"
43 changes: 1 addition & 42 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1 @@
# The following lints are ALLOWED in all Symphonia crates.
#
# --------------------------------------------------------------------------------------------------
#
# Lint:
# clippy::manual_range_contains
#
# Justification:
# Where possible, expressing an algorithm as closely as possible to the specification is
# preferrable. Rewriting using range syntax provides marginal benefit, but could be confusing.
#
# --------------------------------------------------------------------------------------------------
#
# Lint:
# clippy::comparison_chain
#
# Justification:
# There is a performance penalty associated with the recommended idiom.
#
# --------------------------------------------------------------------------------------------------
#
# Lint:
# clippy::excessive_precision
#
# Justification:
# Floating point constants provided by specifications and papers often provide extra digits that
# are truncated when using 32-bit floating point airthmetic. By keeping this precision, we can use
# the values provided directly & without modification, and, when investigating accuracy issues,
# we can easily switch to 64-bit floating point arithmetic and benefit from the higher precision.
#
# --------------------------------------------------------------------------------------------------
#
# Lint:
# clippy::identity_op
#
# Justification:
# Sometimes the base or initial case of an unrolled multi-iteration/step mathematical expression
# contains operations that are otherwise no-ops. Disable the warning for these expressions because
# they're instructive to the reader and improve the code aesthetics.
#
# --------------------------------------------------------------------------------------------------
msrv = "1.77"
msrv = "1.77"
6 changes: 3 additions & 3 deletions symphonia-bundle-flac/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "flac"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
Expand All @@ -22,6 +25,3 @@ version = "0.5.4"
path = "../symphonia-metadata"
default-features = false
features = ["flac"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
9 changes: 0 additions & 9 deletions symphonia-bundle-flac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

mod decoder;
mod demuxer;
mod frame;
Expand Down
3 changes: 3 additions & 0 deletions symphonia-bundle-mp3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "mp3", "mpeg"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[features]
default = ["mp1", "mp2", "mp3"]
mp1 = []
Expand Down
9 changes: 0 additions & 9 deletions symphonia-bundle-mp3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

// Shared modules.
mod common;
mod header;
Expand Down
3 changes: 3 additions & 0 deletions symphonia-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ edition = "2021"
rust-version = "1.77"
publish = false

[lints]
workspace = true

[dependencies]
clap = "3.1.0"
log = { version = "0.4", features = ["release_max_level_info"] }
Expand Down
2 changes: 0 additions & 2 deletions symphonia-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// Justification: Fields on DecoderOptions and FormatOptions may change at any time, but
// symphonia-check doesn't want to be updated every time those fields change, therefore always fill
// in the remaining fields with default values.
Expand Down
3 changes: 3 additions & 0 deletions symphonia-codec-aac/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "aac", "m4a"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
lazy_static = "1.4.0"
Expand Down
8 changes: 0 additions & 8 deletions symphonia-codec-aac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]
// TODO: Remove this when refactoring AAC.
#![allow(clippy::needless_range_loop)]

Expand Down
3 changes: 3 additions & 0 deletions symphonia-codec-adpcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "adpcm"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
9 changes: 0 additions & 9 deletions symphonia-codec-adpcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

use symphonia_core::codecs::registry::{RegisterableAudioDecoder, SupportedAudioCodec};
use symphonia_core::codecs::CodecInfo;
use symphonia_core::support_audio_codec;
Expand Down
5 changes: 4 additions & 1 deletion symphonia-codec-alac/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "alac"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
8 changes: 0 additions & 8 deletions symphonia-codec-alac/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]
// Disable to better express the specification.
#![allow(clippy::collapsible_else_if)]

Expand Down
3 changes: 3 additions & 0 deletions symphonia-codec-opus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "opus"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
5 changes: 4 additions & 1 deletion symphonia-codec-pcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "pcm"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
9 changes: 0 additions & 9 deletions symphonia-codec-pcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

use symphonia_core::codecs::registry::{RegisterableAudioDecoder, SupportedAudioCodec};
use symphonia_core::codecs::CodecInfo;
use symphonia_core::support_audio_codec;
Expand Down
5 changes: 4 additions & 1 deletion symphonia-codec-vorbis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ keywords = ["audio", "codec", "decoder", "vorbis"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
symphonia-common = { version = "0.5.4", path = "../symphonia-common" }
symphonia-common = { version = "0.5.4", path = "../symphonia-common" }
8 changes: 0 additions & 8 deletions symphonia-codec-vorbis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

#![warn(rust_2018_idioms)]
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]
// Disable to better express the specification.
#![allow(clippy::collapsible_else_if)]

Expand Down
5 changes: 4 additions & 1 deletion symphonia-codec-wavpack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "wavpack"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
5 changes: 4 additions & 1 deletion symphonia-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ keywords = ["audio", "multimedia", "media", "xiph"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }

[dependencies.symphonia-metadata]
version = "0.5.4"
path = "../symphonia-metadata"
default-features = false
features = ["flac"]
features = ["flac"]
7 changes: 0 additions & 7 deletions symphonia-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,5 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

pub mod mpeg;
pub mod xiph;
11 changes: 5 additions & 6 deletions symphonia-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "codec", "decoder", "multimedia", "media"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[features]
default = []

Expand All @@ -21,11 +24,7 @@ opt-simd-avx = ["rustfft/avx"]
opt-simd-neon = ["rustfft/neon"]

# Enable all SIMD support.
opt-simd = [
"opt-simd-sse",
"opt-simd-avx",
"opt-simd-neon",
]
opt-simd = ["opt-simd-sse", "opt-simd-avx", "opt-simd-neon"]

[dependencies]
bitflags = "2.4.2"
Expand All @@ -38,4 +37,4 @@ smallvec = "1.13.1"
[dependencies.rustfft]
version = "6.1.0"
optional = true
default-features = false
default-features = false
7 changes: 0 additions & 7 deletions symphonia-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#![forbid(unsafe_code)]
// The following lints are allowed in all Symphonia crates. Please see clippy.toml for their
// justification.
#![allow(clippy::comparison_chain)]
#![allow(clippy::excessive_precision)]
#![allow(clippy::identity_op)]
#![allow(clippy::manual_range_contains)]

pub mod audio;
pub mod checksum;
Expand Down
3 changes: 3 additions & 0 deletions symphonia-format-caf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ keywords = ["audio", "media", "demuxer", "caf"]
edition = "2021"
rust-version = "1.77"

[lints]
workspace = true

[dependencies]
log = "0.4"
symphonia-core = { version = "0.5.4", path = "../symphonia-core" }
Loading