From 422f6832b872b0bc649b37f9c48abeef806e1355 Mon Sep 17 00:00:00 2001 From: rChaser53 Date: Tue, 18 Feb 2020 21:35:39 +0900 Subject: [PATCH] Backport 4042 fix not to break relative path link --- src/string.rs | 1 + tests/target/issue-4023.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/target/issue-4023.rs diff --git a/src/string.rs b/src/string.rs index b65aa5b33b2..a8ded0f2379 100644 --- a/src/string.rs +++ b/src/string.rs @@ -169,6 +169,7 @@ fn detect_url(s: &[&str], index: usize) -> Option { || split.contains("http://") || split.contains("ftp://") || split.contains("file://") + || split.contains("./") { match s[index..].iter().position(|g| is_whitespace(g)) { Some(pos) => Some(index + pos - 1), diff --git a/tests/target/issue-4023.rs b/tests/target/issue-4023.rs new file mode 100644 index 00000000000..702ef33c633 --- /dev/null +++ b/tests/target/issue-4023.rs @@ -0,0 +1,14 @@ +// rustfmt-max_width: 100 +// rustfmt-wrap_comments: true +// rustfmt-comment_width: 80 +// rustfmt-normalize_comments: true +// rustfmt-unstable_features: true + +/// [`MANAGE_MESSAGES`](../permissions/struct.Permissions.html#associatedconstant.MANAGE_MESSAGES) +/// [`MANAGE_CHANNEL`](./permissions/struct.Permissions.html#associatedconstant.MANAGE_CHANNEL) +struct Test { + /// [`MANAGE_MESSAGES`]: ../permissions/struct.Permissions.html#associatedconstant.MANAGE_MESSAGES + /// [`MANAGE_CHANNEL`]: ./permissions/struct.Permissions.html#associatedconstant.MANAGE_CHANNEL + #[serde(default, rename = "rate_limit_per_user")] + pub rate_limit: u16, +}