You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0162]: irrefutable if-let pattern
(エラー: 論駁不可能なif-letパターン)
--><anon>:2:8
|2|if let x = 5 {
|^ irrefutable pattern
実際には次のようになりました。
cargo run
warning: irrefutable `if let` pattern
--> src\main.rs:2:8
|
2 | if let x = 5 {
| ^^^^^^^^^
|
= note: this pattern will always match, so the `if let` is useless
= help: consider replacing the `if let` with a `let`
= note: `#[warn(irrefutable_let_patterns)]` on by default
warning: `testing` (bin "testing") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target\debug\testing.exe`
5
$ cargo run
Compiling patterns v0.1.0 (file:///projects/patterns)
warning: irrefutable `if let` pattern
--> src/main.rs:2:8
|
2 | if let x = 5 {
| ^^^^^^^^^
|
= note: `#[warn(irrefutable_let_patterns)]` on by default
= note: this pattern will always match, so the `if let` is useless
= help: consider replacing the `if let` with a `let`
warning: `patterns` (bin "patterns") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.39s
Running `target/debug/patterns`
5
The text was updated successfully, but these errors were encountered:
次のコードをビルドすると
次のように出力されると記載があります。
実際には次のようになりました。
英語版も実際の動作に一致する内容で記載されています。
https://doc.rust-lang.org/book/ch18-02-refutability.html
The text was updated successfully, but these errors were encountered: