Skip to content

Commit

Permalink
Rollup merge of rust-lang#123204 - notriddle:notriddle/include-str-sp…
Browse files Browse the repository at this point in the history
…an, r=pnkfelix

rustdoc: point at span in `include_str!`-ed md file

Fixes rust-lang#118549
  • Loading branch information
matthiaskrgr authored Apr 12, 2024
2 parents d13ccf3 + 24e1071 commit 2e989dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/large_include_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl LateLintPass<'_> for LargeIncludeFile {
span_lint_and_note(
cx,
LARGE_INCLUDE_FILE,
expr.span,
expr.span.source_callsite(),
"attempted to include a large file",
None,
format!(
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
e.span,
"calling `as_bytes()` on `include_str!(..)`",
"consider using `include_bytes!(..)` instead",
snippet_with_applicability(cx, receiver.span, r#""foo""#, &mut applicability).replacen(
snippet_with_applicability(cx, receiver.span.source_callsite(), r#""foo""#, &mut applicability).replacen(
"include_str",
"include_bytes",
1,
Expand Down
2 changes: 0 additions & 2 deletions tests/ui-toml/large_include_file/large_include_file.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
= note: the configuration allows a maximum size of 600 bytes
= note: `-D clippy::large-include-file` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::large_include_file)]`
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

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

error: aborting due to 2 previous errors

11 changes: 6 additions & 5 deletions tests/ui/empty_docs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ LL | ///
= help: consider removing or filling it

error: empty doc comment
--> tests/ui/empty_docs.rs:30:5
--> tests/ui/empty_docs.rs:30:13
|
LL | #[doc = ""]
| ^^^^^^^^^^^
| ^^
|
= help: consider removing or filling it

error: empty doc comment
--> tests/ui/empty_docs.rs:33:5
--> tests/ui/empty_docs.rs:33:13
|
LL | / #[doc = ""]
LL | #[doc = ""]
| _____________^
LL | | #[doc = ""]
| |_______________^
| |______________^
|
= help: consider removing or filling it

Expand Down

0 comments on commit 2e989dc

Please sign in to comment.