Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-01-25 11:23:46 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-01-25 11:31:19 +0300
commit3b4c48d9f55ae5bfb6eb4fe485edf54f8916d955 (patch)
tree69f065a49d4035b924d0c1f7025186d597a55590 /video/closedcaption
parentad3f1cf534b475d47d4ef4d0e8916d507c6e56e5 (diff)
Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1062>
Diffstat (limited to 'video/closedcaption')
-rw-r--r--video/closedcaption/src/cea608tott/imp.rs12
-rw-r--r--video/closedcaption/src/jsontovtt/imp.rs5
-rw-r--r--video/closedcaption/src/mcc_enc/imp.rs12
-rw-r--r--video/closedcaption/src/mcc_parse/parser.rs4
-rw-r--r--video/closedcaption/src/scc_enc/imp.rs4
-rw-r--r--video/closedcaption/src/scc_parse/parser.rs4
-rw-r--r--video/closedcaption/tests/mcc_parse.rs4
-rw-r--r--video/closedcaption/tests/scc_parse.rs4
8 files changed, 23 insertions, 26 deletions
diff --git a/video/closedcaption/src/cea608tott/imp.rs b/video/closedcaption/src/cea608tott/imp.rs
index 92bd01f8c..c265dc7a3 100644
--- a/video/closedcaption/src/cea608tott/imp.rs
+++ b/video/closedcaption/src/cea608tott/imp.rs
@@ -201,11 +201,10 @@ impl Cea608ToTt {
writeln!(
&mut data,
- "{:02}:{:02}:{:02}.{:03} --> {:02}:{:02}:{:02}.{:03}\r",
- h1, m1, s1, ms1, h2, m2, s2, ms2
+ "{h1:02}:{m1:02}:{s1:02}.{ms1:03} --> {h2:02}:{m2:02}:{s2:02}.{ms2:03}\r"
)
.unwrap();
- writeln!(&mut data, "{}\r", text).unwrap();
+ writeln!(&mut data, "{text}\r").unwrap();
writeln!(&mut data, "\r").unwrap();
let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes());
@@ -231,14 +230,13 @@ impl Cea608ToTt {
let (h1, m1, s1, ms1) = Self::split_time(timestamp);
let (h2, m2, s2, ms2) = Self::split_time(timestamp + duration);
- writeln!(&mut data, "{}\r", index).unwrap();
+ writeln!(&mut data, "{index}\r").unwrap();
writeln!(
&mut data,
- "{:02}:{:02}:{:02},{:03} --> {:02}:{:02}:{:02},{:03}\r",
- h1, m1, s1, ms1, h2, m2, s2, ms2
+ "{h1:02}:{m1:02}:{s1:02},{ms1:03} --> {h2:02}:{m2:02}:{s2:02},{ms2:03}\r"
)
.unwrap();
- writeln!(&mut data, "{}\r", text).unwrap();
+ writeln!(&mut data, "{text}\r").unwrap();
writeln!(&mut data, "\r").unwrap();
let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes());
diff --git a/video/closedcaption/src/jsontovtt/imp.rs b/video/closedcaption/src/jsontovtt/imp.rs
index 5e0fb44eb..42e029409 100644
--- a/video/closedcaption/src/jsontovtt/imp.rs
+++ b/video/closedcaption/src/jsontovtt/imp.rs
@@ -155,11 +155,10 @@ impl State {
writeln!(
&mut data,
- "{:02}:{:02}:{:02}.{:03} --> {:02}:{:02}:{:02}.{:03}",
- h1, m1, s1, ms1, h2, m2, s2, ms2
+ "{h1:02}:{m1:02}:{s1:02}.{ms1:03} --> {h2:02}:{m2:02}:{s2:02}.{ms2:03}"
)
.unwrap();
- writeln!(&mut data, "{}", text).unwrap();
+ writeln!(&mut data, "{text}").unwrap();
let mut buffer = gst::Buffer::from_mut_slice(data.into_bytes());
{
diff --git a/video/closedcaption/src/mcc_enc/imp.rs b/video/closedcaption/src/mcc_enc/imp.rs
index 4524b1f06..32656e888 100644
--- a/video/closedcaption/src/mcc_enc/imp.rs
+++ b/video/closedcaption/src/mcc_enc/imp.rs
@@ -77,7 +77,7 @@ impl MccEnc {
Err(structure::GetError::FieldNotFound { .. }) => {
return Err(gst::FlowError::NotNegotiated);
}
- err => panic!("MccEnc::generate_headers caps: {:?}", err),
+ err => panic!("MccEnc::generate_headers caps: {err:?}"),
};
if framerate == gst::Fraction::new(60000, 1001) {
@@ -87,7 +87,7 @@ impl MccEnc {
}
if let Some(ref uuid) = settings.uuid {
- let _ = write!(buffer, "UUID={}\r\n", uuid);
+ let _ = write!(buffer, "UUID={uuid}\r\n");
} else {
let _ = write!(buffer, "UUID={:X}\r\n", Uuid::new_v4().as_hyphenated());
}
@@ -291,10 +291,10 @@ impl MccEnc {
match state.format {
Some(Format::Cea608) => {
- let _ = write!(outbuf, "6102{:02X}", len);
+ let _ = write!(outbuf, "6102{len:02X}");
}
Some(Format::Cea708Cdp) => {
- let _ = write!(outbuf, "T{:02X}", len);
+ let _ = write!(outbuf, "T{len:02X}");
}
_ => return Err(gst::FlowError::NotNegotiated),
};
@@ -305,7 +305,7 @@ impl MccEnc {
if checksum == 0 {
outbuf.push(b'Z');
} else {
- let _ = write!(outbuf, "{:02X}", checksum);
+ let _ = write!(outbuf, "{checksum:02X}");
}
outbuf.extend_from_slice(b"\r\n".as_ref());
@@ -354,7 +354,7 @@ impl MccEnc {
gst::error!(CAT, obj: pad, "Caps without framerate");
return false;
}
- err => panic!("MccEnc::sink_event caps: {:?}", err),
+ err => panic!("MccEnc::sink_event caps: {err:?}"),
};
let mut state = self.state.lock().unwrap();
diff --git a/video/closedcaption/src/mcc_parse/parser.rs b/video/closedcaption/src/mcc_parse/parser.rs
index 0d818e1ed..6c847b21b 100644
--- a/video/closedcaption/src/mcc_parse/parser.rs
+++ b/video/closedcaption/src/mcc_parse/parser.rs
@@ -682,7 +682,7 @@ mod tests {
while let Some(line) = reader.line() {
let res = match parser.parse_line(line, true) {
Ok(res) => res,
- Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err),
+ Err(err) => panic!("Couldn't parse line {line_cnt}: {err:?}"),
};
match line_cnt {
@@ -714,7 +714,7 @@ mod tests {
42 => assert_eq!(res, MccLine::TimeCodeRate(30, true)),
_ => match res {
MccLine::Caption(_, _) => (),
- res => panic!("Expected caption at line {}, got {:?}", line_cnt, res),
+ res => panic!("Expected caption at line {line_cnt}, got {res:?}"),
},
}
diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs
index 58c2b4970..c2d24af50 100644
--- a/video/closedcaption/src/scc_enc/imp.rs
+++ b/video/closedcaption/src/scc_enc/imp.rs
@@ -197,7 +197,7 @@ impl State {
.expect("Buffer without timecode")
.tc();
- let _ = write!(outbuf, "{}\t", timecode);
+ let _ = write!(outbuf, "{timecode}\t");
line_start = false;
} else {
outbuf.push(b' ');
@@ -280,7 +280,7 @@ impl SccEnc {
gst::error!(CAT, obj: pad, "Caps without framerate");
return false;
}
- err => panic!("SccEnc::sink_event caps: {:?}", err),
+ err => panic!("SccEnc::sink_event caps: {err:?}"),
};
let mut state = self.state.lock().unwrap();
diff --git a/video/closedcaption/src/scc_parse/parser.rs b/video/closedcaption/src/scc_parse/parser.rs
index 603112d79..8f2998476 100644
--- a/video/closedcaption/src/scc_parse/parser.rs
+++ b/video/closedcaption/src/scc_parse/parser.rs
@@ -340,7 +340,7 @@ mod tests {
while let Some(line) = reader.line() {
let res = match parser.parse_line(line) {
Ok(res) => res,
- Err(err) => panic!("Couldn't parse line {}: {:?}", line_cnt, err),
+ Err(err) => panic!("Couldn't parse line {line_cnt}: {err:?}"),
};
match line_cnt {
@@ -348,7 +348,7 @@ mod tests {
x if x % 2 != 0 => assert_eq!(res, SccLine::Empty),
_ => match res {
SccLine::Caption(_, _) => (),
- res => panic!("Expected caption at line {}, got {:?}", line_cnt, res),
+ res => panic!("Expected caption at line {line_cnt}, got {res:?}"),
},
}
diff --git a/video/closedcaption/tests/mcc_parse.rs b/video/closedcaption/tests/mcc_parse.rs
index 8c67fae87..fc438d72f 100644
--- a/video/closedcaption/tests/mcc_parse.rs
+++ b/video/closedcaption/tests/mcc_parse.rs
@@ -37,7 +37,7 @@ fn test_parse() {
)
} else {
let seed = rand::random::<u64>();
- println!("seed {}", seed);
+ println!("seed {seed}");
rand::rngs::SmallRng::seed_from_u64(seed)
};
@@ -132,7 +132,7 @@ fn test_pull() {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/captions-test_708.mcc");
- let mut h = gst_check::Harness::new_parse(&format!("filesrc location={:?} ! mccparse", path));
+ let mut h = gst_check::Harness::new_parse(&format!("filesrc location={path:?} ! mccparse"));
h.play();
diff --git a/video/closedcaption/tests/scc_parse.rs b/video/closedcaption/tests/scc_parse.rs
index 542ed711f..8b20ab5e0 100644
--- a/video/closedcaption/tests/scc_parse.rs
+++ b/video/closedcaption/tests/scc_parse.rs
@@ -40,7 +40,7 @@ fn test_parse() {
)
} else {
let seed = rand::random::<u64>();
- println!("seed {}", seed);
+ println!("seed {seed}");
rand::rngs::SmallRng::seed_from_u64(seed)
};
@@ -199,7 +199,7 @@ fn test_pull() {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/dn2018-1217.scc");
- let mut h = gst_check::Harness::new_parse(&format!("filesrc location={:?} ! sccparse", path));
+ let mut h = gst_check::Harness::new_parse(&format!("filesrc location={path:?} ! sccparse"));
h.play();