Skip to content

Commit 0c21841

Browse files
committed
fix corner case
1 parent cc1ab93 commit 0c21841

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/doc/rustc-dev-guide/ci/sembr/src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ struct Cli {
2222
static REGEX_IGNORE: LazyLock<Regex> =
2323
LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*)\s+").unwrap());
2424
static REGEX_IGNORE_END: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|\?|;|!)$").unwrap());
25+
static REGEX_IGNORE_LINK_TARGETS: LazyLock<Regex> =
26+
LazyLock::new(|| Regex::new(r"^\[.+\]: ").unwrap());
2527
static REGEX_SPLIT: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|\?|;|!)\s+").unwrap());
2628

2729
fn main() -> Result<()> {
@@ -94,6 +96,7 @@ fn ignore(line: &str, in_code_block: bool) -> bool {
9496
|| line.starts_with('#')
9597
|| line.trim().is_empty()
9698
|| REGEX_IGNORE.is_match(line)
99+
|| REGEX_IGNORE_LINK_TARGETS.is_match(line)
97100
}
98101

99102
fn comply(content: &str) -> String {
@@ -221,6 +224,15 @@ fn test_prettify_prefix_spaces() {
221224
assert_eq!(expected, lengthen_lines(original, 50));
222225
}
223226

227+
#[test]
228+
fn test_prettify_ignore_link_targets() {
229+
let original = "\
230+
[a target]: https://example.com
231+
[another target]: https://example.com
232+
";
233+
assert_eq!(original, lengthen_lines(original, 100));
234+
}
235+
224236
#[test]
225237
fn test_sembr_then_prettify() {
226238
let original = "\

src/doc/rustc-dev-guide/src/tests/ci.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ a single try build running on a single PR at any given time.
210210
211211
Note that try builds are handled using the [new bors] implementation.
212212
213-
[rustc-perf]: https://github.com/rust-lang/rustc-perf [new bors]: https://github.com/rust-lang/bors
213+
[rustc-perf]: https://github.com/rust-lang/rustc-perf
214+
[new bors]: https://github.com/rust-lang/bors
214215
215216
### Modifying CI jobs
216217
@@ -476,7 +477,8 @@ To do this:
476477
[`jobs.yml`]: https://github.com/rust-lang/rust/blob/master/src/ci/github-actions/jobs.yml
477478
[`.github/workflows/ci.yml`]: https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml
478479
[`src/ci/citool`]: https://github.com/rust-lang/rust/blob/master/src/ci/citool
479-
[bors]: https://github.com/bors [homu]: https://github.com/rust-lang/homu
480+
[bors]: https://github.com/bors
481+
[homu]: https://github.com/rust-lang/homu
480482
[merge queue]: https://bors.rust-lang.org/queue/rust
481483
[dist-x86_64-linux]: https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
482484
[the GitHub Actions workflows page]: https://github.com/rust-lang/rust/actions

0 commit comments

Comments
 (0)