Skip to content

Commit

Permalink
Fix build warnings (#589)
Browse files Browse the repository at this point in the history
* Ignore `cfg(fuzzing)`

* Remove `cfg(feature = "total_cmp")`
  • Loading branch information
Serial-ATA authored Jul 1, 2024
1 parent e9329e2 commit 40642c8
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ members = [
]
resolver = "2"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }

[profile.dev]
opt-level = 0
3 changes: 3 additions & 0 deletions constraints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ env_logger = "0.11.3"
lazy_static = "1"
serde_json = { version = "1", features = ["preserve_order"] }

[lints]
workspace = true

[features]
default = ["serde"]
serde = ["dep:serde", "indexmap/serde"]
Expand Down
15 changes: 0 additions & 15 deletions constraints/src/algorithms/select_settings/select_optimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,8 @@ where
for (candidate, fitness_distance) in candidates {
use std::cmp::Ordering;

#[cfg(feature = "total_cmp")]
let ordering = fitness_distance.total_cmp(&optimal_fitness_distance);

// TODO: remove fallback once MSRV has been bumped to 1.62 or later:
#[cfg(not(feature = "total_cmp"))]
let ordering = {
// See http://doc.rust-lang.org/1.65.0/core/primitive.f64.html#method.total_cmp:

let mut left = fitness_distance.to_bits() as i64;
let mut right = optimal_fitness_distance.to_bits() as i64;

left ^= (((left >> 63) as u64) >> 1) as i64;
right ^= (((right >> 63) as u64) >> 1) as i64;

left.cmp(&right)
};

if ordering == Ordering::Less {
// Candidate is new optimal, so drop current selection:
optimal_candidates.clear();
Expand Down
3 changes: 3 additions & 0 deletions data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ portable-atomic = "1.6"
tokio-test = "0.4" # must match the min version of the `tokio` crate above
env_logger = "0.11.3"
chrono = "0.4.28"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions dtls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ chrono = "0.4.28"
clap = "3"
hub = {path = "examples/hub"}

[lints]
workspace = true

[features]
pem = ["dep:pem"]

Expand Down
3 changes: 3 additions & 0 deletions ice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ lazy_static = "1"
hyper = { version = "0.14.27", features = ["full"] }
sha1 = "0.10"

[lints]
workspace = true

[[example]]
name = "ping_pong"
path = "examples/ping_pong.rs"
Expand Down
3 changes: 3 additions & 0 deletions interceptor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ portable-atomic = "1.6"
[dev-dependencies]
tokio-test = "0.4"
chrono = "0.4.28"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ env_logger = "0.11.3"
chrono = "0.4.28"
clap = "3"

[lints]
workspace = true

[[example]]
name = "mdns_query"
path = "examples/mdns_query.rs"
Expand Down
3 changes: 3 additions & 0 deletions media/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ rand = "0.8"
criterion = { version = "0.5", features = ["html_reports"] }
nearly_eq = "0.2"

[lints]
workspace = true

[[bench]]
name = "audio_buffer"
harness = false
3 changes: 3 additions & 0 deletions rtcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ util = { version = "0.9.0", path = "../util", package = "webrtc-util", default-f

bytes = "1"
thiserror = "1"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions rtp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ memchr = "2.1.1"
chrono = "0.4.28"
criterion = "0.5"

[lints]
workspace = true

[[bench]]
name = "packet_bench"
harness = false
3 changes: 3 additions & 0 deletions sctp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ env_logger = "0.11.3"
chrono = "0.4.28"
clap = "3"

[lints]
workspace = true

[[example]]
name = "ping"
path = "examples/ping.rs"
Expand Down
3 changes: 3 additions & 0 deletions sdp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ substring = "1"
[dev-dependencies]
criterion = "0.5"

[lints]
workspace = true

[[bench]]
name = "bench"
harness = false
3 changes: 3 additions & 0 deletions srtp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ criterion = { version = "0.5", features = ["async_futures"] }
tokio-test = "0.4"
lazy_static = "1"

[lints]
workspace = true

[[bench]]
name = "srtp_bench"
harness = false
2 changes: 2 additions & 0 deletions stun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ tokio-test = "0.4"
clap = "3"
criterion = "0.5"

[lints]
workspace = true

[[bench]]
name = "bench"
Expand Down
3 changes: 3 additions & 0 deletions turn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ hex = "0.4"
clap = "3"
criterion = "0.5"

[lints]
workspace = true

[features]
metrics = []

Expand Down
3 changes: 3 additions & 0 deletions util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ chrono = "0.4.28"
criterion = { version = "0.5", features = ["async_futures"] }
async-global-executor = "2"

[lints]
workspace = true

[[bench]]
name = "bench"
harness = false
3 changes: 3 additions & 0 deletions webrtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ portable-atomic = "1.6"
tokio-test = "0.4"
env_logger = "0.11.3"

[lints]
workspace = true

[features]
pem = ["dep:pem", "dtls/pem"]
openssl = ["srtp/openssl"]
Expand Down

0 comments on commit 40642c8

Please sign in to comment.