Skip to content

Commit 412dfa6

Browse files
committed
Build fix attempt rust-lang#2.
1 parent c5b5560 commit 412dfa6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clippy_lints/src/methods/path_join_correction.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@ use super::PATH_JOIN_CORRECTION;
99

1010
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, join_arg: &'tcx Expr<'tcx>, span: Span) {
1111
let ty = cx.typeck_results().expr_ty(expr);
12-
if is_type_diagnostic_item(cx, ty, Path) {
13-
let applicability = Applicability::MachineApplicable;
14-
if_chain!(
15-
if let ExprKind::Lit(spanned) = &join_arg.kind;
16-
if let LitKind::Str(symbol, _) = spanned.node;
17-
if symbol.as_str().starts_with('/') || symbol.as_str().starts_with('\\');
18-
then {
19-
span_lint_and_sugg(
20-
cx,
21-
PATH_JOIN_CORRECTION,
22-
span.with_hi(expr.span.hi()),
12+
if_chain!(
13+
if is_type_diagnostic_item(cx, ty, Path);
14+
let applicability = Applicability::MachineApplicable;
15+
if let ExprKind::Lit(spanned) = &join_arg.kind;
16+
if let LitKind::Str(symbol, _) = spanned.node;
17+
if symbol.as_str().starts_with('/') || symbol.as_str().starts_with('\\');
18+
then {
19+
span_lint_and_sugg(
20+
cx,
21+
PATH_JOIN_CORRECTION,
22+
span.with_hi(expr.span.hi()),
2323
r#"argument in join called on path contains a starting '/'"#,
2424
"try removing first '/' or '\\'",
2525
"join(\"your/path/here\")".to_owned(),
2626
applicability
2727
);
2828
}
2929
);
30-
}
3130
}

0 commit comments

Comments
 (0)