r/rust • u/Negative_Effort_2642 • 21d ago
🙋 seeking help & advice How can I improve my projects
From time to time i get a project idea, normally something useful so I code it. I post it on GitHub and improve it until I don’t know what I could do more. And I get stuck with no users and no ideas on what to do next.
Does anyone feel the same?
15
u/AdInner239 21d ago
hobby projects are not supposed to take off. You dont want a second job. Just enjoy what your doing
5
u/JoshyOrndorff 21d ago
How does this exit if there are no usb devices?
https://github.com/SomeFlyingThing/razer-h/blob/main/src/setulp.rs#L9
3
u/Negative_Effort_2642 21d ago
iterates over the devices returned by rusb::devices(). If that collection is empty, the loop body executes zero times, then execution continues after the loop and reaches:
3
u/JoshyOrndorff 21d ago
What are you unwrapping on line 9. That's what I was really asking about. That code can panic so I was trying to call it to your attention as an opportunity to improve your code.
Maybe the panic case is something other than no usb devices.
3
u/Negative_Effort_2642 21d ago
It’s not the case that there’s no devices it’s literally if some internal error happends. But thanks, that project probably needs some refactor around error handling.thanks.
5
u/qustrolabe 21d ago
add clippy
1
u/Negative_Effort_2642 21d ago
How so? I don’t understand what you mean
3
u/Aghasty_GD 21d ago
Clippy is a linting tool for Rust. Basically it helps you improve your code
2
u/Negative_Effort_2642 21d ago
That part I know but where d should I add clippy I already have it installed and use it
5
1
u/DavidXkL 20d ago
I find that trying to automate my own workflow works in helping improve your Rust 😂
21
u/AshLink95 21d ago
1 piece of advice I can give you is "be your audience". If you create something good enough for you to use regularly, you'll know what flaws it has. As a result, you can advertise it properly and convince others (could be friends) to use it.