]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-36023.rs
Rollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum
[rust.git] / src / test / ui / issues / issue-36023.rs
1 // run-pass
2 #![allow(unused_variables)]
3 use std::ops::Deref;
4
5 fn main() {
6     if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") {
7         panic!()
8     }
9
10     let env_home: Result<String, ()> = Ok("foo-bar-baz".to_string());
11     let env_home = env_home.as_ref().map(Deref::deref).ok();
12
13     if env_home == Some("") { panic!() }
14 }
15
16 #[inline(never)]
17 fn env_var(s: &str) -> Result<String, VarError> {
18     Err(VarError::NotPresent)
19 }
20
21 pub enum VarError {
22     NotPresent,
23     NotUnicode(String),
24 }