From a60cd8f2a96aae3f7db8dfccec2aa5cf21f8c411 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 25 Aug 2024 17:30:02 +0200 Subject: refactor(treewide): Conform to `cargo clippy` --- crates/yt_dlp/src/lib.rs | 8 +++++--- crates/yt_dlp/src/logging.rs | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'crates/yt_dlp/src') diff --git a/crates/yt_dlp/src/lib.rs b/crates/yt_dlp/src/lib.rs index b0dffa4..2f554a9 100644 --- a/crates/yt_dlp/src/lib.rs +++ b/crates/yt_dlp/src/lib.rs @@ -81,7 +81,7 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) } #[pyfunction] -pub fn progress_hook<'a>(py: Python, input: Bound<'_, PyDict>) -> PyResult<()> { +pub fn progress_hook(py: Python, input: Bound<'_, PyDict>) -> PyResult<()> { // Only add the handler, if the log-level is higher than Debug (this avoids covering debug // messages). if log_enabled!(Level::Debug) { @@ -350,7 +350,9 @@ pub async fn download( let result_string = if let Some(filename) = info_json.filename { filename } else { - (&info_json.requested_downloads.expect("This must exist")[0].filename).to_owned() + info_json.requested_downloads.expect("This must exist")[0] + .filename + .to_owned() }; out_paths.push(result_string); @@ -407,7 +409,7 @@ fn json_loads(py: Python, input: String) -> PyResult> { .clone()) } -fn get_yt_dlp_utils<'a>(py: Python<'a>) -> PyResult> { +fn get_yt_dlp_utils(py: Python<'_>) -> PyResult> { let yt_dlp = PyModule::import_bound(py, "yt_dlp")?; let utils = yt_dlp.getattr("utils")?; diff --git a/crates/yt_dlp/src/logging.rs b/crates/yt_dlp/src/logging.rs index cca917c..02af3ff 100644 --- a/crates/yt_dlp/src/logging.rs +++ b/crates/yt_dlp/src/logging.rs @@ -20,7 +20,7 @@ use pyo3::{ /// Consume a Python `logging.LogRecord` and emit a Rust `Log` instead. #[pyfunction] -fn host_log<'a>(record: Bound<'a, PyAny>, rust_target: &str) -> PyResult<()> { +fn host_log(record: Bound<'_, PyAny>, rust_target: &str) -> PyResult<()> { let level = record.getattr("levelno")?; let message = record.getattr("getMessage")?.call0()?.to_string(); let pathname = record.getattr("pathname")?.to_string(); @@ -42,8 +42,7 @@ fn host_log<'a>(record: Bound<'a, PyAny>, rust_target: &str) -> PyResult<()> { }; let target = full_target - .as_ref() - .map(|x| x.as_str()) + .as_deref() .unwrap_or(rust_target); // error -- cgit 1.4.1