]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/enum-method-probe.rs
1 // compile-flags: --edition=2021
14 fn test_result_in_result() -> Result
<(), ()> {
15 let res
: Result
<_
, ()> = Ok(Foo
);
17 //~^ ERROR no method named `get` found for enum `Result` in the current scope
18 //~| HELP use the `?` operator
22 async
fn async_test_result_in_result() -> Result
<(), ()> {
23 let res
: Result
<_
, ()> = Ok(Foo
);
25 //~^ ERROR no method named `get` found for enum `Result` in the current scope
26 //~| HELP use the `?` operator
30 fn test_result_in_unit_return() {
31 let res
: Result
<_
, ()> = Ok(Foo
);
33 //~^ ERROR no method named `get` found for enum `Result` in the current scope
34 //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err`
37 async
fn async_test_result_in_unit_return() {
38 let res
: Result
<_
, ()> = Ok(Foo
);
40 //~^ ERROR no method named `get` found for enum `Result` in the current scope
41 //~| HELP consider using `Result::expect` to unwrap the `Foo` value, panicking if the value is a `Result::Err`
44 fn test_option_in_option() -> Option
<()> {
45 let res
: Option
<_
> = Some(Foo
);
47 //~^ ERROR no method named `get` found for enum `Option` in the current scope
48 //~| HELP use the `?` operator
52 fn test_option_in_unit_return() {
53 let res
: Option
<_
> = Some(Foo
);
55 //~^ ERROR no method named `get` found for enum `Option` in the current scope
56 //~| HELP consider using `Option::expect` to unwrap the `Foo` value, panicking if the value is an `Option::None`