Hi guys,
I started learning Rust about a week and made some project. my last project is a youtube downloader.
I need your advices about my code and how can I improve it.
you can find it in here
thanks
Hi guys,
I started learning Rust about a week and made some project. my last project is a youtube downloader.
I need your advices about my code and how can I improve it.
you can find it in here
thanks
Very nice!
You can get some style hints from Clippy (cargo +nightly install clippy --force
+ cargo +nightly clippy
)
Instead of i += 1
in a loop, you could use iter().enumerate()
. You can also create the whole hashmap in one go with:
let qualities: HashMap<_,_> = streams.iter().map(…).collect();
And the next step for the program could be to switch from handling errors by panicing to returning them. -> Result<(), Box<Error>>
(use std::error::Error
) is a convenient return type, because it allows you to use ?
operator on almost any result-returning function.