]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/dead-code/issue-85071-2.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / lint / dead-code / issue-85071-2.rs
1 // A slight variation of issue-85071.rs. Here, a method is called instead
2 // of a function, and the warning is about an unreachable definition
3 // instead of an unreachable expression.
4
5 // check-pass
6
7 #![warn(unused_variables,unreachable_code)]
8
9 enum Foo {}
10
11 struct S;
12 impl S {
13     fn f(&self) -> Foo {todo!()}
14 }
15
16 fn main() {
17     let s = S;
18     let x = s.f();
19     //~^ WARNING: unused variable: `x`
20     let _y = x;
21     //~^ WARNING: unreachable definition
22 }