this post was submitted on 01 Mar 2026
23 points (96.0% liked)

Programming

25860 readers
419 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
 

I am using rust, but this applies to many other languages, I get warnings like, dead code, unused variables, and etc, and while I remove most of them, there are some im not sure of, I like running my program and there being 0 warnings, or 0 warnings as i scroll down my code, so for things im unsure of, i mark them so the compiler doesn't put warnings there. I also add comments, starting with TODO:, it has some information about what to think about when i revisit it, also the todo's gets highlighed in my IDE with my extension, but is this bad practice?

you are viewing a single comment's thread
view the rest of the comments
[–] matsdis@piefed.social 6 points 18 hours ago* (last edited 18 hours ago)

Depends. I would flag it in a code review on our product, and same for most TODO comments. It's bad practice to leave them for your team to deal with, or even for yourself two years later.

But for explorative coding (mostly just one person, things like game development or creative coding, or before finishing your branch) I think dead code warnings do more damage than they help. They make you look at things not worth looking at right now, until you figured out what you want to build. Like unused structs or imports just because you commented out some line to test something. I didn't turn all annoyances off, but I feel I should. I have a hard time just ignoring them. I think it's better to enable them later when the code is stabilizing, to clean up experiments that didn't work out. When I just ignore them I also ignore a more important warnings, and waste time wondering why my stuff isn't working while the compiler is actually telling me why.

Also, in Rust many clippy defaults are too pedantic IMO, so I turn them off for good. Here is what I currently use:

[lints.rust]  
dead_code = "allow"  

[lints.clippy]  
new_without_default = "allow"  
match_like_matches_macro = "allow"  
manual_range_patterns = "allow"  
comparison_chain = "allow"  
collapsible_if = "allow"  
collapsible_else_if = "allow"  
let_and_return = "allow"  
identity_op = "allow"  # I'll multiply by one whenever I like!  
# Just disable all style hints?  
# style = "allow"