[unnecessary_literal_unwrap]: don't lint if binding initializer is expn
This commit is contained in:
parent
ba3bd8f0f1
commit
6868c0a74b
3 changed files with 25 additions and 0 deletions
|
|
@ -68,6 +68,16 @@ fn unwrap_methods_result() {
|
|||
1;
|
||||
}
|
||||
|
||||
fn unwrap_from_binding() {
|
||||
macro_rules! from_macro {
|
||||
() => {
|
||||
Some("")
|
||||
};
|
||||
}
|
||||
let val = from_macro!();
|
||||
let _ = val.unwrap_or("");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unwrap_option_some();
|
||||
unwrap_option_none();
|
||||
|
|
|
|||
|
|
@ -68,6 +68,16 @@ fn unwrap_methods_result() {
|
|||
Ok::<_, ()>(1).unwrap_or_else(|_| 2);
|
||||
}
|
||||
|
||||
fn unwrap_from_binding() {
|
||||
macro_rules! from_macro {
|
||||
() => {
|
||||
Some("")
|
||||
};
|
||||
}
|
||||
let val = from_macro!();
|
||||
let _ = val.unwrap_or("");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unwrap_option_some();
|
||||
unwrap_option_none();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue