Skip to content

Commit ee9de3b

Browse files
committed
Fully remove notrust markers from rustdoc
Internally refactor all mentions of `notrust` to the positive statement `rust`.
1 parent 8f51ad2 commit ee9de3b

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
174174
let rlang = slice::from_raw_buf(&(*lang).data,
175175
(*lang).size as uint);
176176
let rlang = str::from_utf8(rlang).unwrap();
177-
if LangString::parse(rlang).notrust {
177+
if !LangString::parse(rlang).rust {
178178
(my_opaque.dfltblk)(ob, orig_text, lang,
179179
opaque as *mut libc::c_void);
180180
true
@@ -320,7 +320,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
320320
let s = str::from_utf8(lang).unwrap();
321321
LangString::parse(s)
322322
};
323-
if block_info.notrust { return }
323+
if !block_info.rust { return }
324324
let text = slice::from_raw_buf(&(*text).data, (*text).size as uint);
325325
let opaque = opaque as *mut hoedown_html_renderer_state;
326326
let tests = &mut *((*opaque).opaque as *mut ::test::Collector);
@@ -373,7 +373,7 @@ struct LangString {
373373
should_fail: bool,
374374
no_run: bool,
375375
ignore: bool,
376-
notrust: bool,
376+
rust: bool,
377377
test_harness: bool,
378378
}
379379

@@ -383,7 +383,7 @@ impl LangString {
383383
should_fail: false,
384384
no_run: false,
385385
ignore: false,
386-
notrust: false,
386+
rust: false,
387387
test_harness: false,
388388
}
389389
}
@@ -403,14 +403,13 @@ impl LangString {
403403
"should_fail" => { data.should_fail = true; seen_rust_tags = true; },
404404
"no_run" => { data.no_run = true; seen_rust_tags = true; },
405405
"ignore" => { data.ignore = true; seen_rust_tags = true; },
406-
"notrust" => { data.notrust = true; seen_rust_tags = true; },
407-
"rust" => { data.notrust = false; seen_rust_tags = true; },
406+
"rust" => { data.rust = true; seen_rust_tags = true; },
408407
"test_harness" => { data.test_harness = true; seen_rust_tags = true; }
409408
_ => { seen_other_tags = true }
410409
}
411410
}
412411

413-
data.notrust |= seen_other_tags && !seen_rust_tags;
412+
data.rust |= !seen_other_tags || seen_rust_tags;
414413

415414
data
416415
}
@@ -452,28 +451,27 @@ mod tests {
452451
#[test]
453452
fn test_lang_string_parse() {
454453
fn t(s: &str,
455-
should_fail: bool, no_run: bool, ignore: bool, notrust: bool, test_harness: bool) {
454+
should_fail: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool) {
456455
assert_eq!(LangString::parse(s), LangString {
457456
should_fail: should_fail,
458457
no_run: no_run,
459458
ignore: ignore,
460-
notrust: notrust,
459+
rust: rust,
461460
test_harness: test_harness,
462461
})
463462
}
464463

465-
t("", false,false,false,false,false);
466-
t("rust", false,false,false,false,false);
467-
t("sh", false,false,false,true,false);
468-
t("notrust", false,false,false,true,false);
469-
t("ignore", false,false,true,false,false);
470-
t("should_fail", true,false,false,false,false);
471-
t("no_run", false,true,false,false,false);
472-
t("test_harness", false,false,false,false,true);
473-
t("{.no_run .example}", false,true,false,false,false);
474-
t("{.sh .should_fail}", true,false,false,false,false);
475-
t("{.example .rust}", false,false,false,false,false);
476-
t("{.test_harness .rust}", false,false,false,false,true);
464+
t("", false,false,false,true,false);
465+
t("rust", false,false,false,true,false);
466+
t("sh", false,false,false,false,false);
467+
t("ignore", false,false,true,true,false);
468+
t("should_fail", true,false,false,true,false);
469+
t("no_run", false,true,false,true,false);
470+
t("test_harness", false,false,false,true,true);
471+
t("{.no_run .example}", false,true,false,true,false);
472+
t("{.sh .should_fail}", true,false,false,true,false);
473+
t("{.example .rust}", false,false,false,true,false);
474+
t("{.test_harness .rust}", false,false,false,true,true);
477475
}
478476

479477
#[test]

0 commit comments

Comments
 (0)