]> git.lizzy.rs Git - rust.git/commitdiff
Fully remove `notrust` markers from rustdoc
authorFlorian Gilcher <florian.gilcher@asquera.de>
Wed, 10 Dec 2014 11:17:14 +0000 (12:17 +0100)
committerFlorian Gilcher <florian.gilcher@asquera.de>
Sun, 21 Dec 2014 14:48:40 +0000 (15:48 +0100)
Internally refactor all mentions of `notrust` to the
positive statement `rust`.

src/librustdoc/html/markdown.rs

index 8b2f644dfe33bd2a57b2647336bf86289a265fbc..5581874ea3aff2a1f7d24244bbc2e16c9950e99b 100644 (file)
@@ -174,7 +174,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
                 let rlang = slice::from_raw_buf(&(*lang).data,
                                                 (*lang).size as uint);
                 let rlang = str::from_utf8(rlang).unwrap();
-                if LangString::parse(rlang).notrust {
+                if !LangString::parse(rlang).rust {
                     (my_opaque.dfltblk)(ob, orig_text, lang,
                                         opaque as *mut libc::c_void);
                     true
@@ -320,7 +320,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
                 let s = str::from_utf8(lang).unwrap();
                 LangString::parse(s)
             };
-            if block_info.notrust { return }
+            if !block_info.rust { return }
             let text = slice::from_raw_buf(&(*text).data, (*text).size as uint);
             let opaque = opaque as *mut hoedown_html_renderer_state;
             let tests = &mut *((*opaque).opaque as *mut ::test::Collector);
@@ -373,7 +373,7 @@ struct LangString {
     should_fail: bool,
     no_run: bool,
     ignore: bool,
-    notrust: bool,
+    rust: bool,
     test_harness: bool,
 }
 
@@ -383,7 +383,7 @@ fn all_false() -> LangString {
             should_fail: false,
             no_run: false,
             ignore: false,
-            notrust: false,
+            rust: false,
             test_harness: false,
         }
     }
@@ -403,14 +403,13 @@ fn parse(string: &str) -> LangString {
                 "should_fail" => { data.should_fail = true; seen_rust_tags = true; },
                 "no_run" => { data.no_run = true; seen_rust_tags = true; },
                 "ignore" => { data.ignore = true; seen_rust_tags = true; },
-                "notrust" => { data.notrust = true; seen_rust_tags = true; },
-                "rust" => { data.notrust = false; seen_rust_tags = true; },
+                "rust" => { data.rust = true; seen_rust_tags = true; },
                 "test_harness" => { data.test_harness = true; seen_rust_tags = true; }
                 _ => { seen_other_tags = true }
             }
         }
 
-        data.notrust |= seen_other_tags && !seen_rust_tags;
+        data.rust |=  !seen_other_tags || seen_rust_tags;
 
         data
     }
@@ -452,28 +451,27 @@ mod tests {
     #[test]
     fn test_lang_string_parse() {
         fn t(s: &str,
-             should_fail: bool, no_run: bool, ignore: bool, notrust: bool, test_harness: bool) {
+            should_fail: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool) {
             assert_eq!(LangString::parse(s), LangString {
                 should_fail: should_fail,
                 no_run: no_run,
                 ignore: ignore,
-                notrust: notrust,
+                rust: rust,
                 test_harness: test_harness,
             })
         }
 
-        t("", false,false,false,false,false);
-        t("rust", false,false,false,false,false);
-        t("sh", false,false,false,true,false);
-        t("notrust", false,false,false,true,false);
-        t("ignore", false,false,true,false,false);
-        t("should_fail", true,false,false,false,false);
-        t("no_run", false,true,false,false,false);
-        t("test_harness", false,false,false,false,true);
-        t("{.no_run .example}", false,true,false,false,false);
-        t("{.sh .should_fail}", true,false,false,false,false);
-        t("{.example .rust}", false,false,false,false,false);
-        t("{.test_harness .rust}", false,false,false,false,true);
+        t("", false,false,false,true,false);
+        t("rust", false,false,false,true,false);
+        t("sh", false,false,false,false,false);
+        t("ignore", false,false,true,true,false);
+        t("should_fail", true,false,false,true,false);
+        t("no_run", false,true,false,true,false);
+        t("test_harness", false,false,false,true,true);
+        t("{.no_run .example}", false,true,false,true,false);
+        t("{.sh .should_fail}", true,false,false,true,false);
+        t("{.example .rust}", false,false,false,true,false);
+        t("{.test_harness .rust}", false,false,false,true,true);
     }
 
     #[test]