From 252983a36876a2938fb689cda73c73025f9b3a53 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Sat, 1 Feb 2025 01:25:42 -0500 Subject: [PATCH] Clean up README and one condition The compiler prefers `Vec.is_empty()` to `Vec.len() == 0`. --- README.md | 11 ++++++++--- src/main.rs | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0c160a9..513b8fd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,13 @@ (N.B.: This software has not been made very useful for the non-amcooper user.) -This utility finds all your (well, my) Wallabag entries, and tags all the untagged ones "untagged". This allows the user to filter on the new tag, as there's no way to run a filter on untagged entries in the web UI. +This utility finds all your (well, my) Wallabag entries, and tags all the +untagged ones "untagged". This allows the user to filter on the new tag, as +there's no way to run a filter on untagged entries in the web UI. -Run the utility as follows: ` WALLABAG_CLIENT_SECRET= WALLABAG_PASSWORD= cargo run` +Run the utility as follows: `WALLABAG_CLIENT_SECRET= +WALLABAG_PASSWORD= cargo run` -It's a bit YOLO. There's almost no logging, no dry run, no way to limit the number of candidate entries, in general no way to recover if something goes awry. Even so, it can't really do a ton of damage as currently constructed. +It's a bit YOLO. There's almost no logging, no dry run, no way to limit the +number of candidate entries, in general no way to recover if something goes +awry. Even so, it can't really do a ton of damage as currently constructed. diff --git a/src/main.rs b/src/main.rs index b52824c..f1d0683 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,10 +26,10 @@ async fn main() -> std::io::Result<()> { } Ok(entries) => { for entry in entries { - if entry.tags.len() == 0 { - let _ = client.add_tags_to_entry(entry.id, vec!["untagged"]).await; - println!("{:?}", entry.title); - } + if entry.tags.is_empty() { + let _ = client.add_tags_to_entry(entry.id, vec!["untagged"]).await; + println!("{:?}", entry.title); + } } } }