diff options
| author | bors <bors@rust-lang.org> | 2019-04-29 05:18:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-29 05:18:12 +0000 |
| commit | 1b6caa7cd6ae86b580e691b3f075d946800ee51b (patch) | |
| tree | 2ca444c4ef15f604296e29ed5b75e9e01566ab3b /src | |
| parent | c7fcbfbf1fff2794de5ec6dcb0a052c345ded3a7 (diff) | |
| parent | 2ae7b0c8983b377d1c11ab63f13acc9df0d8e745 (diff) | |
| download | rust-1b6caa7cd6ae86b580e691b3f075d946800ee51b.tar.gz rust-1b6caa7cd6ae86b580e691b3f075d946800ee51b.zip | |
Auto merge of #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
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/docker/scripts/sccache.sh | 2 | ||||
| -rw-r--r-- | src/librustc/error_codes.rs | 1 | ||||
| -rw-r--r-- | src/librustc_typeck/error_codes.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/style.rs | 17 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/ci/docker/scripts/sccache.sh b/src/ci/docker/scripts/sccache.sh index e05246201dd..4c03419894e 100644 --- a/src/ci/docker/scripts/sccache.sh +++ b/src/ci/docker/scripts/sccache.sh @@ -1,5 +1,3 @@ -# ignore-tidy-linelength - set -ex curl -fo /usr/local/bin/sccache \ diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs index f6917c45d57..7f68b35d014 100644 --- a/src/librustc/error_codes.rs +++ b/src/librustc/error_codes.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength #![allow(non_snake_case)] // Error messages for EXXXX errors. diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs index ba67593ce96..fdca3230904 100644 --- a/src/librustc_typeck/error_codes.rs +++ b/src/librustc_typeck/error_codes.rs @@ -1,4 +1,3 @@ -// ignore-tidy-linelength // ignore-tidy-filelength #![allow(non_snake_case)] diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 599b6c676fb..e860f2e9df0 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -38,7 +38,7 @@ when executed when assertions are disabled. Use llvm::report_fatal_error for increased robustness."; /// Parser states for `line_is_url`. -#[derive(PartialEq)] +#[derive(Clone, Copy, PartialEq)] #[allow(non_camel_case_types)] enum LIUState { EXP_COMMENT_START, @@ -56,11 +56,12 @@ enum LIUState { fn line_is_url(line: &str) -> bool { use self::LIUState::*; let mut state: LIUState = EXP_COMMENT_START; + let is_url = |w: &str| w.starts_with("http://") || w.starts_with("https://"); for tok in line.split_whitespace() { match (state, tok) { - (EXP_COMMENT_START, "//") => state = EXP_LINK_LABEL_OR_URL, - (EXP_COMMENT_START, "///") => state = EXP_LINK_LABEL_OR_URL, + (EXP_COMMENT_START, "//") | + (EXP_COMMENT_START, "///") | (EXP_COMMENT_START, "//!") => state = EXP_LINK_LABEL_OR_URL, (EXP_LINK_LABEL_OR_URL, w) @@ -68,14 +69,18 @@ fn line_is_url(line: &str) -> bool { => state = EXP_URL, (EXP_LINK_LABEL_OR_URL, w) - if w.starts_with("http://") || w.starts_with("https://") + if is_url(w) => state = EXP_END, (EXP_URL, w) - if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") + if is_url(w) || w.starts_with("../") => state = EXP_END, - (_, _) => return false, + (_, w) + if w.len() > COLS && is_url(w) + => state = EXP_END, + + (_, _) => {} } } |
