google/comprehensive-rust

Don't silence warnings in exercises

Open

#71 建立於 2022年12月27日

在 GitHub 查看
 (4 留言) (3 反應) (0 負責人)Rust (2,009 fork)batch import
enhancementhelp wanted

倉庫指標

Star
 (32,954 star)
PR 合併指標
 (平均合併 9天 23小時) (30 天內合併 36 個 PR)

描述

All the exercises start with something like

// TODO: remove this when you're done with your implementation.
#![allow(unused_variables, dead_code)]

You're training people that it's normal and a good idea to ignore warnings during development. Instead, continue to emphasize what you mention in passing elsewhere -- Rust has great compiler errors!

Of course it's going to have a lot of warnings at the start since you've given them incomplete code. You can

  • Just let them deal with it
  • Or mention RUSTFLAGS=-A... cargo ... perhaps

But you shouldn't imply ignoring warnings until you're "done with your implementation" is a good idea, or IMO that ignoring warnings in your source code (as opposed to a command line flag) is a good idea.

貢獻者指南