Skip to content

Commit cd4bf7f

Browse files
committed
cleanup: Span::new -> Span::with_lo
1 parent 5fec618 commit cd4bf7f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clippy_lints/src/unit_return_expecting_ord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Spa
127127
then {
128128
let data = stmt.span.data();
129129
// Make a span out of the semicolon for the help message
130-
Some((span, Some(Span::new(data.hi-BytePos(1), data.hi, data.ctxt))))
130+
Some((span, Some(data.with_lo(data.hi-BytePos(1)))))
131131
} else {
132132
Some((span, None))
133133
}

clippy_lints/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl EarlyLintPass for Write {
299299
let nl_span = match (dest, only_nl) {
300300
// Special case of `write!(buf, "\n")`: Mark everything from the end of
301301
// `buf` for removal so no trailing comma [`writeln!(buf, )`] remains.
302-
(Some(dest_expr), true) => Span::new(dest_expr.span.hi(), nl_span.hi(), nl_span.ctxt()),
302+
(Some(dest_expr), true) => nl_span.with_lo(dest_expr.span.hi()),
303303
_ => nl_span,
304304
};
305305
span_lint_and_then(

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ fn line_span<T: LintContext>(cx: &T, span: Span) -> Span {
877877
let source_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap();
878878
let line_no = source_map_and_line.line;
879879
let line_start = source_map_and_line.sf.lines[line_no];
880-
Span::new(line_start, span.hi(), span.ctxt())
880+
span.with_lo(line_start)
881881
}
882882

883883
/// Gets the parent node, if any.

0 commit comments

Comments
 (0)