Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f3328ce

Browse files
authoredApr 28, 2019
Rollup merge of rust-lang#60338 - petrochenkov:notidy, r=varkor
tidy: Fix some more false positives for long URLs A URL that's simply longer than 100 characters is ok regardless of context. r? @varkor
2 parents bdfdbcd + 2ae7b0c commit f3328ce

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed
 

‎src/ci/docker/scripts/sccache.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# ignore-tidy-linelength
2-
31
set -ex
42

53
curl -fo /usr/local/bin/sccache \

‎src/librustc/error_codes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
#![allow(non_snake_case)]
32

43
// Error messages for EXXXX errors.

‎src/librustc_typeck/error_codes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore-tidy-linelength
21
// ignore-tidy-filelength
32

43
#![allow(non_snake_case)]

‎src/tools/tidy/src/style.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ when executed when assertions are disabled.
3838
Use llvm::report_fatal_error for increased robustness.";
3939

4040
/// Parser states for `line_is_url`.
41-
#[derive(PartialEq)]
41+
#[derive(Clone, Copy, PartialEq)]
4242
#[allow(non_camel_case_types)]
4343
enum LIUState {
4444
EXP_COMMENT_START,
@@ -56,26 +56,31 @@ enum LIUState {
5656
fn line_is_url(line: &str) -> bool {
5757
use self::LIUState::*;
5858
let mut state: LIUState = EXP_COMMENT_START;
59+
let is_url = |w: &str| w.starts_with("http://") || w.starts_with("https://");
5960

6061
for tok in line.split_whitespace() {
6162
match (state, tok) {
62-
(EXP_COMMENT_START, "//") => state = EXP_LINK_LABEL_OR_URL,
63-
(EXP_COMMENT_START, "///") => state = EXP_LINK_LABEL_OR_URL,
63+
(EXP_COMMENT_START, "//") |
64+
(EXP_COMMENT_START, "///") |
6465
(EXP_COMMENT_START, "//!") => state = EXP_LINK_LABEL_OR_URL,
6566

6667
(EXP_LINK_LABEL_OR_URL, w)
6768
if w.len() >= 4 && w.starts_with('[') && w.ends_with("]:")
6869
=> state = EXP_URL,
6970

7071
(EXP_LINK_LABEL_OR_URL, w)
71-
if w.starts_with("http://") || w.starts_with("https://")
72+
if is_url(w)
7273
=> state = EXP_END,
7374

7475
(EXP_URL, w)
75-
if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../")
76+
if is_url(w) || w.starts_with("../")
7677
=> state = EXP_END,
7778

78-
(_, _) => return false,
79+
(_, w)
80+
if w.len() > COLS && is_url(w)
81+
=> state = EXP_END,
82+
83+
(_, _) => {}
7984
}
8085
}
8186

0 commit comments

Comments
 (0)
Please sign in to comment.