diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 17:30:02 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 17:30:02 +0200 |
commit | a60cd8f2a96aae3f7db8dfccec2aa5cf21f8c411 (patch) | |
tree | 24dc96e5384cf9309ae4ec00d6d91497e3253484 /crates/yt_dlp/src | |
parent | docs(yt_dlp/progress_hook): Add a note about the possibility to calculate vid... (diff) | |
download | yt-a60cd8f2a96aae3f7db8dfccec2aa5cf21f8c411.tar.gz yt-a60cd8f2a96aae3f7db8dfccec2aa5cf21f8c411.zip |
refactor(treewide): Conform to `cargo clippy`
Diffstat (limited to '')
-rw-r--r-- | crates/yt_dlp/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/yt_dlp/src/logging.rs | 5 |
2 files changed, 7 insertions, 6 deletions
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<Bound<PyDict>> { .clone()) } -fn get_yt_dlp_utils<'a>(py: Python<'a>) -> PyResult<Bound<'a, PyAny>> { +fn get_yt_dlp_utils(py: Python<'_>) -> PyResult<Bound<'_, PyAny>> { 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 |