question_mark: don't add as_ref() for a call expression
This commit is contained in:
parent
eb9c15a6b3
commit
f58bb5b234
4 changed files with 40 additions and 4 deletions
|
|
@ -70,10 +70,12 @@ impl QuestionMark {
|
|||
replacement = Some(format!("Some({}?)", receiver_str));
|
||||
}
|
||||
}
|
||||
} else if Self::moves_by_default(cx, subject) {
|
||||
replacement = Some(format!("{}.as_ref()?;", receiver_str));
|
||||
} else if Self::moves_by_default(cx, subject)
|
||||
&& !matches!(subject.kind, ExprKind::Call(..) | ExprKind::MethodCall(..))
|
||||
{
|
||||
replacement = Some(format!("{}.as_ref()?;", receiver_str));
|
||||
} else {
|
||||
replacement = Some(format!("{}?;", receiver_str));
|
||||
replacement = Some(format!("{}?;", receiver_str));
|
||||
}
|
||||
|
||||
if let Some(replacement_str) = replacement {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue