Skip to content

Commit 1b73c7d

Browse files
committed
clippy: fix up include_str! spans in diagnostics
1 parent 98642da commit 1b73c7d

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

Diff for: src/tools/clippy/clippy_lints/src/large_include_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl LateLintPass<'_> for LargeIncludeFile {
7171
span_lint_and_note(
7272
cx,
7373
LARGE_INCLUDE_FILE,
74-
expr.span,
74+
expr.span.source_callsite(),
7575
"attempted to include a large file",
7676
None,
7777
&format!(

Diff for: src/tools/clippy/clippy_lints/src/strings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
300300
e.span,
301301
"calling `as_bytes()` on `include_str!(..)`",
302302
"consider using `include_bytes!(..)` instead",
303-
snippet_with_applicability(cx, receiver.span, r#""foo""#, &mut applicability).replacen(
303+
snippet_with_applicability(cx, receiver.span.source_callsite(), r#""foo""#, &mut applicability).replacen(
304304
"include_str",
305305
"include_bytes",
306306
1,

Diff for: src/tools/clippy/tests/ui-toml/large_include_file/large_include_file.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
77
= note: the configuration allows a maximum size of 600 bytes
88
= note: `-D clippy::large-include-file` implied by `-D warnings`
99
= help: to override `-D warnings` add `#[allow(clippy::large_include_file)]`
10-
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
1110

1211
error: attempted to include a large file
1312
--> tests/ui-toml/large_include_file/large_include_file.rs:14:35
@@ -16,7 +15,6 @@ LL | const TOO_BIG_INCLUDE_STR: &str = include_str!("too_big.txt");
1615
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1716
|
1817
= note: the configuration allows a maximum size of 600 bytes
19-
= note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
2018

2119
error: aborting due to 2 previous errors
2220

Diff for: src/tools/clippy/tests/ui/empty_docs.stderr

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ LL | ///
2525
= help: consider removing or filling it
2626

2727
error: empty doc comment
28-
--> tests/ui/empty_docs.rs:30:5
28+
--> tests/ui/empty_docs.rs:30:13
2929
|
3030
LL | #[doc = ""]
31-
| ^^^^^^^^^^^
31+
| ^^
3232
|
3333
= help: consider removing or filling it
3434

3535
error: empty doc comment
36-
--> tests/ui/empty_docs.rs:33:5
36+
--> tests/ui/empty_docs.rs:33:13
3737
|
38-
LL | / #[doc = ""]
38+
LL | #[doc = ""]
39+
| _____________^
3940
LL | | #[doc = ""]
40-
| |_______________^
41+
| |______________^
4142
|
4243
= help: consider removing or filling it
4344

0 commit comments

Comments
 (0)