Fix a couple of new clippy warnings

This commit is contained in:
Sebastian Dröge 2021-12-02 22:31:52 +02:00
parent febbd5c2c9
commit 66e987c174
5 changed files with 6 additions and 11 deletions

View file

@ -39,7 +39,7 @@ impl FileLocation {
}
Err(err) => Err(glib::Error::new(
gst::URIError::BadUri,
format!("Couldn't parse URI {}: {}", uri_str, err.to_string()).as_str(),
format!("Couldn't parse URI {}: {}", uri_str, err).as_str(),
)),
}
}
@ -74,12 +74,7 @@ impl FileLocation {
let parent_canonical = parent_dir.canonicalize().map_err(|err| {
glib::Error::new(
gst::URIError::BadReference,
format!(
"Could not resolve path {}: {}",
location_str,
err.to_string(),
)
.as_str(),
format!("Could not resolve path {}: {}", location_str, err,).as_str(),
)
})?;

View file

@ -251,7 +251,7 @@ fn main() -> Result<(), Error> {
msg.src()
.map(|s| String::from(s.path_string()))
.unwrap_or_else(|| "None".into()),
err.error().to_string(),
err.error(),
err.debug().unwrap_or_else(|| "".into()),
);
break;

View file

@ -93,7 +93,7 @@ fn main() -> anyhow::Result<()> {
.map(|uri| {
let p = Path::new(&uri);
match p.canonicalize() {
Ok(p) => format!("file://{}", p.to_str().unwrap().to_string()),
Ok(p) => format!("file://{}", p.to_str().unwrap()),
_ => uri,
}
})

View file

@ -387,8 +387,8 @@ fn eia608_to_text(cc_data: u16) -> String {
unsafe {
let bufsz = ffi::eia608_to_text(std::ptr::null_mut(), 0, cc_data);
let mut data = Vec::with_capacity((bufsz + 1) as usize);
data.set_len(bufsz as usize);
ffi::eia608_to_text(data.as_ptr() as *mut _, (bufsz + 1) as usize, cc_data);
data.set_len(bufsz as usize);
String::from_utf8_unchecked(data)
}
}

View file

@ -53,8 +53,8 @@ fn eia608_to_text(cc_data: u16) -> String {
unsafe {
let bufsz = ffi::eia608_to_text(std::ptr::null_mut(), 0, cc_data);
let mut data = Vec::with_capacity((bufsz + 1) as usize);
data.set_len(bufsz as usize);
ffi::eia608_to_text(data.as_ptr() as *mut _, (bufsz + 1) as usize, cc_data);
data.set_len(bufsz as usize);
String::from_utf8_unchecked(data)
}
}