tao-of-rust-codes
tao-of-rust-codes copied to clipboard
2.5.1 节,if判断不建议使用小括号
页码与行数
- 第22页
- 代码清单2-16
- 第三行
代码错误
let big_n = if (n < 10 && n > -10) {
// 小括号导致warning
Rust Playground Demo
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=08e03bc15c70e2e26eeff1559bbd7672
错误信息
warning: unnecessary parentheses around `if` condition
感谢反馈