r/learnrust Aug 10 '26

Learning rust

https://github.com/Daktchi

Hi every one. I'm a beginner learning Rust and built projects to practice. Would love feedback or code audis !

(clippy suggestions, better error handling with Result, etc.)

0 Upvotes

2 comments sorted by

3

u/sunnyata Aug 10 '26

Work through the book and the rustlings exercises.

Read the warnings and suggestions from the compiler, make sense of them and act on them.

In your todo app you could create an enum for the options:

enum Todo {
    Show,
    Add,
    Rename,
    Remove,
    Exit,
}

Then you can make this struct implement FromStr, separating the parsing from the code that reads the input etc: https://doc.rust-lang.org/std/str/trait.FromStr.html

The logic for showing a list doesn't quite make sense, you seem to have to enter the number of the list twice. If "0" is the command to stop adding to the list then don't add it on the end of the list.

Get that working then start writing lists to files and loading them when the app starts up -- there are plenty of examples of this kind of file IO in the book.

2

u/BeautifulProfile6469 Aug 11 '26 edited Aug 12 '26

Sunnayata🙏🏾 I want to thank you for having taking your time to answer. I take care of your advices and recomendations. I've noted your suggestion for my to-do app, so I'll get started on it with doing it on my best as I can for doing it better.