Skip to content

Commit

Permalink
Remove unnecessary semicolon from Rustdoc-generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Dec 28, 2020
1 parent bd06478 commit 87c97d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,12 @@ crate fn make_test(
"fn main() {{ {}fn {}() -> Result<(), impl core::fmt::Debug> {{\n",
inner_attr, inner_fn_name
),
format!("\n}}; {}().unwrap() }}", inner_fn_name),
format!("\n}} {}().unwrap() }}", inner_fn_name),
)
} else if test_id.is_some() {
(
format!("fn main() {{ {}fn {}() {{\n", inner_attr, inner_fn_name),
format!("\n}}; {}() }}", inner_fn_name),
format!("\n}} {}() }}", inner_fn_name),
)
} else {
("fn main() {\n".into(), "\n}".into())
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/doctest/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ use std::io;
let mut input = String::new();
io::stdin().read_line(&mut input)?;
Ok::<(), io:Error>(())
}; _inner().unwrap() }"
} _inner().unwrap() }"
.to_string();
let (output, len, _) = make_test(input, None, false, &opts, DEFAULT_EDITION, None);
assert_eq!((output, len), (expected, 2));
Expand All @@ -306,7 +306,7 @@ fn make_test_named_wrapper() {
let expected = "#![allow(unused)]
fn main() { #[allow(non_snake_case)] fn _doctest_main__some_unique_name() {
assert_eq!(2+2, 4);
}; _doctest_main__some_unique_name() }"
} _doctest_main__some_unique_name() }"
.to_string();
let (output, len, _) =
make_test(input, None, false, &opts, DEFAULT_EDITION, Some("_some_unique_name"));
Expand Down

0 comments on commit 87c97d3

Please sign in to comment.