From 701def6089f148bae2699c2dede3c928f552f5e8 Mon Sep 17 00:00:00 2001 From: Coin de Gamma Date: Wed, 4 Sep 2024 15:30:17 +0000 Subject: [PATCH] list sorted --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 002fb34..f2597b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -94,7 +94,9 @@ fn add(id: &String) -> io::Result<()> { fn list() -> io:: Result<()> { let db = read_db()?; - for item in db.iter() { + let mut vec: Vec<_> = db.iter().collect(); + vec.sort(); + for item in &vec { println!("{}", item); } Ok(())