Auto merge of #9487 - kraktus:question_mark, r=Jarcho

Silence [`question_mark`] in const context

fix https://github.com/rust-lang/rust-clippy/issues/9175

When `const_try` is stabilised can be turned into a MSRV

changelog: Silence [`question_mark`] in const context
This commit is contained in:
bors 2022-09-27 01:12:54 +00:00
commit 78dc616a7a
3 changed files with 24 additions and 4 deletions

View file

@ -223,3 +223,12 @@ fn pattern() -> Result<(), PatternedError> {
}
fn main() {}
// should not lint, `?` operator not available in const context
const fn issue9175(option: Option<()>) -> Option<()> {
if option.is_none() {
return None;
}
//stuff
Some(())
}

View file

@ -259,3 +259,12 @@ fn pattern() -> Result<(), PatternedError> {
}
fn main() {}
// should not lint, `?` operator not available in const context
const fn issue9175(option: Option<()>) -> Option<()> {
if option.is_none() {
return None;
}
//stuff
Some(())
}