mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 00:43:50 +00:00
![Armin Ronacher](/assets/img/avatar_default.png)
This lint complains when the question mark operator (try operator) is used. This is a restriction lint that can be useful on local scopes where a custom error handling macro is supposed to be used to augment the error based on local scope data before returning.
16 lines
241 B
Rust
16 lines
241 B
Rust
// non rustfixable
|
|
#![allow(unreachable_code)]
|
|
#![allow(dead_code)]
|
|
#![warn(clippy::question_mark_used)]
|
|
|
|
fn other_function() -> Option<i32> {
|
|
Some(32)
|
|
}
|
|
|
|
fn my_function() -> Option<i32> {
|
|
other_function()?;
|
|
None
|
|
}
|
|
|
|
fn main() {}
|