Skip to content

Commit fe98155

Browse files
committed
refactor changes to pass if_not_else lint
1 parent b2b98d1 commit fe98155

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clippy_lints/src/swap.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ fn generate_swap_warning(cx: &LateContext<'_>, e1: &Expr<'_>, e2: &Expr<'_>, spa
115115
let second = Sugg::hir_with_applicability(cx, e2, "..", &mut applicability);
116116
let sugg = if !any_parent_has_attr(cx.tcx, e1.hir_id, sym::no_std) {
117117
"std"
118-
} else if !any_parent_has_attr(cx.tcx, e2.hir_id, sym::no_core) {
119-
"core"
120-
} else {
118+
} else if any_parent_has_attr(cx.tcx, e1.hir_id, sym::no_core) {
121119
""
120+
} else {
121+
"core"
122122
};
123123

124124
if sugg.is_empty() {
@@ -201,10 +201,10 @@ fn check_suspicious_swap(cx: &LateContext<'_>, block: &Block<'_>) {
201201
let span = first.span.to(second.span);
202202
let sugg = if !any_parent_has_attr(cx.tcx, block.hir_id, sym::no_std) {
203203
"std"
204-
} else if !any_parent_has_attr(cx.tcx, block.hir_id, sym::no_core) {
205-
"core"
206-
} else {
204+
} else if any_parent_has_attr(cx.tcx, block.hir_id, sym::no_core) {
207205
""
206+
} else {
207+
"core"
208208
};
209209

210210
if sugg.is_empty() {

0 commit comments

Comments
 (0)