From de8ca02048426823ba3efb9a6493f035d8fcbb37 Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Thu, 31 Jul 2025 11:21:33 +0200 Subject: [PATCH] Improve postgres example code style Signed-off-by: Lee Smet --- heromodels/examples/postgres_model_example.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/heromodels/examples/postgres_model_example.rs b/heromodels/examples/postgres_model_example.rs index 6f709ff..437173b 100644 --- a/heromodels/examples/postgres_model_example.rs +++ b/heromodels/examples/postgres_model_example.rs @@ -96,10 +96,10 @@ fn main() { .set(&user4) .expect("can set user"); - println!("User 1 assigned ID: {}", user1_id); - println!("User 2 assigned ID: {}", user2_id); - println!("User 3 assigned ID: {}", user3_id); - println!("User 4 assigned ID: {}", user4_id); + println!("User 1 assigned ID: {user1_id}"); + println!("User 2 assigned ID: {user2_id}"); + println!("User 3 assigned ID: {user3_id}"); + println!("User 4 assigned ID: {user4_id}"); // We already have the updated models from the set method, so we don't need to retrieve them again @@ -140,14 +140,14 @@ fn main() { .expect("can load stored users"); assert_eq!(active_users.len(), 2); - for (_i, active_user) in active_users.iter().enumerate() { + for active_user in active_users.iter() { print_user_details(active_user); } // 3. Delete a user and show the updated results println!("\n3. After Deleting a User:"); let user_to_delete_id = active_users[0].get_id(); - println!("Deleting user with ID: {}", user_to_delete_id); + println!("Deleting user with ID: {user_to_delete_id}"); db.collection::() .expect("can open user collection") .delete_by_id(user_to_delete_id) @@ -162,7 +162,7 @@ fn main() { println!(" a. Remaining Active Users:"); assert_eq!(active_users.len(), 1); - for (_i, active_user) in active_users.iter().enumerate() { + for active_user in active_users.iter() { print_user_details(active_user); } @@ -175,7 +175,7 @@ fn main() { println!(" b. Inactive Users:"); assert_eq!(inactive_users.len(), 2); - for (_i, inactive_user) in inactive_users.iter().enumerate() { + for inactive_user in inactive_users.iter() { print_user_details(inactive_user); } @@ -199,7 +199,7 @@ fn main() { .set(&comment) .expect("can set comment"); - println!("Comment assigned ID: {}", comment_id); + println!("Comment assigned ID: {comment_id}"); println!(" a. Comment Retrieved from Database:"); print_comment_details(&db_comment);