Skip to content

Rollup of 8 pull requests #130919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
561a6c5
[`cfg_match`] Generalize inputs
c410-f3r Sep 13, 2024
ae15032
Rustfmt
c410-f3r Sep 13, 2024
d3e59a5
Revert Break into the debugger on panic (129019)
ChrisDenton Sep 25, 2024
20c0067
add a bootstrap variant of `naked_asm`
folkertdev Sep 13, 2024
42542d8
update `compiler_builtins` to `0.1.126`
folkertdev Sep 13, 2024
fb095cc
cargo update: rustbook
invalid-email-address Sep 22, 2024
fa64fb1
Partially update `library/Cargo.lock`
tgross35 Sep 26, 2024
6915039
Extend rustdoc template check to detect unneeded comments
GuillaumeGomez Sep 22, 2024
575df06
Remove unneeded jinja comments in templates
GuillaumeGomez Sep 22, 2024
c7d171d
On implicit `Sized` bound on fn argument, point at type instead of pa…
estebank Sep 27, 2024
c48b0d4
diagnostics: wrap fn cast suggestions in parens
notriddle Sep 27, 2024
98f567b
Rollup merge of #130313 - c410-f3r:unlock-rfc-2011, r=thomcc
workingjubilee Sep 27, 2024
0b53cec
Rollup merge of #130706 - GuillaumeGomez:remove-unneeded-jinja-commen…
workingjubilee Sep 27, 2024
9734723
Rollup merge of #130846 - ChrisDenton:revert-break, r=Noratrieb
workingjubilee Sep 27, 2024
1e88253
Rollup merge of #130875 - folkertdev:naked-asm-bootstrap, r=tgross35
workingjubilee Sep 27, 2024
dfb3776
Rollup merge of #130889 - tgross35:rustbook-cargo-update, r=tgross35
workingjubilee Sep 27, 2024
081b946
Rollup merge of #130892 - tgross35:library-cargo-update, r=Noratrieb
workingjubilee Sep 27, 2024
6b0c897
Rollup merge of #130911 - notriddle:notriddle/suggest-wrap-parens-fn-…
workingjubilee Sep 27, 2024
b463bd1
Rollup merge of #130912 - estebank:point-at-arg-type, r=compiler-errors
workingjubilee Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Extend rustdoc template check to detect unneeded comments
  • Loading branch information
GuillaumeGomez committed Sep 26, 2024
commit 69150396bf145ab19488263f2a111ef48338dced
34 changes: 33 additions & 1 deletion src/tools/tidy/src/rustdoc_templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,39 @@ pub fn check(librustdoc_path: &Path, bad: &mut bool) {

while let Some((pos, line)) = lines.next() {
let line = line.trim();
if TAGS.iter().any(|(_, tag)| line.ends_with(tag)) {
if let Some(need_next_line_check) = TAGS.iter().find_map(|(tag, end_tag)| {
// We first check if the line ends with a jinja tag.
if !line.ends_with(end_tag) {
return None;
// Then we check if this a comment tag.
} else if *tag != "{#" {
return Some(false);
// And finally we check if the comment is empty (ie, only there to strip
// extra whitespace characters).
} else if let Some(start_pos) = line.rfind(tag) {
Some(line[start_pos + 2..].trim() == "#}")
} else {
Some(false)
}
}) {
// All good, the line is ending is a jinja tag. But maybe this tag is useless
// if the next line starts with a jinja tag as well!
//
// However, only (empty) comment jinja tags are concerned about it.
if need_next_line_check
&& lines.peek().is_some_and(|(_, next_line)| {
let next_line = next_line.trim_start();
TAGS.iter().any(|(tag, _)| next_line.starts_with(tag))
})
{
// It seems like ending this line with a jinja tag is not needed after all.
tidy_error!(
bad,
"`{}` at line {}: unneeded `{{# #}}` tag at the end of the line",
path.path().display(),
pos + 1,
);
}
continue;
}
let Some(next_line) = lines.peek().map(|(_, next_line)| next_line.trim()) else {
Expand Down