]> git.lizzy.rs Git - rust.git/commitdiff
use @ instead of space for link ambiguity markers
authorQuietMisdreavus <grey@quietmisdreavus.net>
Mon, 8 Jan 2018 15:23:12 +0000 (09:23 -0600)
committerManish Goregaokar <manishsmail@gmail.com>
Mon, 22 Jan 2018 09:54:30 +0000 (15:24 +0530)
since spaces aren't allowed in link targets in commonmark, a new symbol
is needed to separate the marker from the rest of the path. hence, @

src/librustdoc/clean/mod.rs

index 5031dddfdf38fd0b9534d28856d5a4b55f76a93d..d4260c3dfb58cbd180d70fd88a45b4bb4d5d2657 100644 (file)
@@ -848,21 +848,21 @@ fn clean(&self, cx: &DocContext) -> Attributes {
                          "trait", "union"].iter()
                                           .find(|p| link.starts_with(**p)) {
                         kind = PathKind::Type;
-                        link.trim_left_matches(prefix).trim()
+                        link.trim_left_matches(prefix).trim_left_matches('@')
                     } else if let Some(prefix) =
                         ["const", "static"].iter()
                                            .find(|p| link.starts_with(**p)) {
                         kind = PathKind::Value;
-                        link.trim_left_matches(prefix).trim()
+                        link.trim_left_matches(prefix).trim_left_matches('@')
                     } else if link.ends_with("()") {
                         kind = PathKind::Value;
-                        link.trim_right_matches("()").trim()
+                        link.trim_right_matches("()")
                     } else if link.ends_with('!') {
                         kind = PathKind::Macro;
-                        link.trim_right_matches('!').trim()
+                        link.trim_right_matches('!')
                     } else {
-                        link.trim()
-                    };
+                        &link[..]
+                    }.trim();
 
                     // avoid resolving things (i.e. regular links) which aren't like paths
                     // FIXME(Manishearth) given that most links have slashes in them might be worth