Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Philipp Krones <[email protected]>
  • Loading branch information
sinkuu and flip1995 authored Mar 4, 2020
1 parent 246709f commit ac6891c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions clippy_lints/src/question_mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl QuestionMark {

then {
let mut applicability = Applicability::MachineApplicable;
let receiver_str = snippet_with_applicability(cx, subject.span, "..", &mut applicability);
let receiver_str = &Sugg::hir_with_applicability(cx, subject, "..", &mut applicability);
let mut replacement: Option<String> = None;
if let Some(else_) = else_ {
if_chain! {
Expand Down Expand Up @@ -124,19 +124,14 @@ impl QuestionMark {
if by_ref { ".as_ref()" } else { "" },
);

span_lint_and_then(
span_lint_and_sugg(
cx,
QUESTION_MARK,
expr.span,
"this if-let-else may be rewritten with the `?` operator",
|db| {
db.span_suggestion(
expr.span,
"replace it with",
replacement,
applicability,
);
}
"replace it with",
replacement,
applicability,
)
}
}
Expand Down

0 comments on commit ac6891c

Please sign in to comment.