Skip to content

Commit 5d8fe95

Browse files
authored
general: apply clippy lints (#407)
* general: update crates to 2021 edition. * general: apply clippy --fix * general: apply manual clippy lints * cargo fmt.
1 parent 95f8c26 commit 5d8fe95

File tree

280 files changed

+894
-1365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+894
-1365
lines changed

constraints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "webrtc-constraints"
33
version = "0.1.0"
44
authors = ["Vincent Esche <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
description = "A pure Rust implementation of WebRTC Media Constraints API"
77
license = "MIT/Apache-2.0"
88
documentation = "https://docs.rs/webrtc-constraints"

constraints/src/algorithms/fitness_distance/setting.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ mod tests {
345345

346346
let expected = 0.0;
347347

348-
println!("constraint: {:?}", constraint);
349-
println!("setting: {:?}", setting);
350-
println!("actual: {:?}", actual);
351-
println!("expected: {:?}", expected);
348+
println!("constraint: {constraint:?}");
349+
println!("setting: {setting:?}");
350+
println!("actual: {actual:?}");
351+
println!("expected: {expected:?}");
352352

353353
assert_eq!(actual, expected);
354354
}
@@ -434,10 +434,10 @@ mod tests {
434434

435435
let expected = 0.0;
436436

437-
println!("constraint: {:?}", constraint);
438-
println!("setting: {:?}", setting);
439-
println!("actual: {:?}", actual);
440-
println!("expected: {:?}", expected);
437+
println!("constraint: {constraint:?}");
438+
println!("setting: {setting:?}");
439+
println!("actual: {actual:?}");
440+
println!("expected: {expected:?}");
441441

442442
assert_eq!(actual, expected);
443443
}

constraints/src/constraint/value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ where
197197
let mut is_first = true;
198198
f.write_str("(")?;
199199
if let Some(ref exact) = &self.exact {
200-
f.write_fmt(format_args!("x == {:?}", exact))?;
200+
f.write_fmt(format_args!("x == {exact:?}"))?;
201201
is_first = false;
202202
}
203203
if let Some(ref ideal) = &self.ideal {
204204
if !is_first {
205205
f.write_str(" && ")?;
206206
}
207-
f.write_fmt(format_args!("x ~= {:?}", ideal))?;
207+
f.write_fmt(format_args!("x ~= {ideal:?}"))?;
208208
is_first = false;
209209
}
210210
if is_first {

constraints/src/constraint/value_range.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,23 +233,23 @@ where
233233
let mut is_first = true;
234234
f.write_str("(")?;
235235
if let Some(exact) = &self.exact {
236-
f.write_fmt(format_args!("x == {:?}", exact))?;
236+
f.write_fmt(format_args!("x == {exact:?}"))?;
237237
is_first = false;
238238
} else if let (Some(min), Some(max)) = (&self.min, &self.max) {
239-
f.write_fmt(format_args!("{:?} <= x <= {:?}", min, max))?;
239+
f.write_fmt(format_args!("{min:?} <= x <= {max:?}"))?;
240240
is_first = false;
241241
} else if let Some(min) = &self.min {
242-
f.write_fmt(format_args!("{:?} <= x", min))?;
242+
f.write_fmt(format_args!("{min:?} <= x"))?;
243243
is_first = false;
244244
} else if let Some(max) = &self.max {
245-
f.write_fmt(format_args!("x <= {:?}", max))?;
245+
f.write_fmt(format_args!("x <= {max:?}"))?;
246246
is_first = false;
247247
}
248248
if let Some(ideal) = &self.ideal {
249249
if !is_first {
250250
f.write_str(" && ")?;
251251
}
252-
f.write_fmt(format_args!("x ~= {:?}", ideal))?;
252+
f.write_fmt(format_args!("x ~= {ideal:?}"))?;
253253
is_first = false;
254254
}
255255
if is_first {

constraints/src/constraint/value_sequence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ where
204204
let mut is_first = true;
205205
f.write_str("(")?;
206206
if let Some(ref exact) = &self.exact {
207-
f.write_fmt(format_args!("x == {:?}", exact))?;
207+
f.write_fmt(format_args!("x == {exact:?}"))?;
208208
is_first = false;
209209
}
210210
if let Some(ref ideal) = &self.ideal {
211211
if !is_first {
212212
f.write_str(" && ")?;
213213
}
214-
f.write_fmt(format_args!("x ~= {:?}", ideal))?;
214+
f.write_fmt(format_args!("x ~= {ideal:?}"))?;
215215
is_first = false;
216216
}
217217
if is_first {

constraints/src/errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl std::fmt::Display for OverconstrainedError {
3131
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3232
write!(f, "Overconstrained property {:?}", self.constraint)?;
3333
if let Some(message) = self.message.as_ref() {
34-
write!(f, ": {}", message)?;
34+
write!(f, ": {message}")?;
3535
}
3636
Ok(())
3737
}
@@ -100,10 +100,10 @@ impl OverconstrainedError {
100100
[reason] => reason.clone(),
101101
[reasons @ .., reason] => {
102102
let reasons = reasons.join(", ");
103-
format!("either {}, or {}", reasons, reason)
103+
format!("either {reasons}, or {reason}")
104104
}
105105
};
106-
let message = Some(format!("Setting was {}.", formatted_reason));
106+
let message = Some(format!("Setting was {formatted_reason}."));
107107

108108
Self {
109109
constraint,

constraints/src/setting.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ pub enum MediaTrackSetting {
2828
impl std::fmt::Display for MediaTrackSetting {
2929
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3030
match self {
31-
Self::Bool(setting) => f.write_fmt(format_args!("{:?}", setting)),
32-
Self::Integer(setting) => f.write_fmt(format_args!("{:?}", setting)),
33-
Self::Float(setting) => f.write_fmt(format_args!("{:?}", setting)),
34-
Self::String(setting) => f.write_fmt(format_args!("{:?}", setting)),
31+
Self::Bool(setting) => f.write_fmt(format_args!("{setting:?}")),
32+
Self::Integer(setting) => f.write_fmt(format_args!("{setting:?}")),
33+
Self::Float(setting) => f.write_fmt(format_args!("{setting:?}")),
34+
Self::String(setting) => f.write_fmt(format_args!("{setting:?}")),
3535
}
3636
}
3737
}

data/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "webrtc-data"
33
version = "0.6.0"
44
authors = ["Rain Liu <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
description = "A pure Rust implementation of WebRTC DataChannel API"
77
license = "MIT/Apache-2.0"
88
documentation = "https://docs.rs/webrtc-data"

dtls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "webrtc-dtls"
33
version = "0.7.0"
44
authors = ["Rain Liu <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
description = "A pure Rust implementation of DTLS"
77
license = "MIT/Apache-2.0"
88
documentation = "https://docs.rs/webrtc-dtls"

dtls/examples/dial/psk/dial_psk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async fn main() -> Result<(), Error> {
5757

5858
let conn = Arc::new(UdpSocket::bind("0.0.0.0:0").await?);
5959
conn.connect(server).await?;
60-
println!("connecting {}..", server);
60+
println!("connecting {server}..");
6161

6262
let config = Config {
6363
psk: Some(Arc::new(|hint: &[u8]| -> Result<Vec<u8>, Error> {

0 commit comments

Comments
 (0)