Skip to content

Commit 5868e28

Browse files
Rollup merge of rust-lang#88211 - petrochenkov:withhilo, r=jyn514
cleanup: `Span::new` -> `Span::with_lo` Extracted from rust-lang#84373 as suggested in rust-lang#84373 (comment). It turned out less useful then I expected, but anyway. r? `@cjgillot` `@bors` rollup
2 parents e5fe462 + cd4bf7f commit 5868e28

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
@@ -881,7 +881,7 @@ fn line_span<T: LintContext>(cx: &T, span: Span) -> Span {
881881
let source_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap();
882882
let line_no = source_map_and_line.line;
883883
let line_start = source_map_and_line.sf.lines[line_no];
884-
Span::new(line_start, span.hi(), span.ctxt())
884+
span.with_lo(line_start)
885885
}
886886

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

0 commit comments

Comments
 (0)