Skip to content

Commit

Permalink
run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 7, 2024
1 parent 3670ad5 commit 6aab04e
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/librustdoc/doctest/make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,13 @@ fn check_for_main_and_extern_crate(
let mut found_extern_crate = crate_name.is_none();
let mut found_macro = false;

let mut parser =
match new_parser_from_source_str(&psess, filename, source.clone()) {
Ok(p) => p,
Err(errs) => {
errs.into_iter().for_each(|err| err.cancel());
return (found_main, found_extern_crate, found_macro);
}
};
let mut parser = match new_parser_from_source_str(&psess, filename, source.clone()) {
Ok(p) => p,
Err(errs) => {
errs.into_iter().for_each(|err| err.cancel());
return (found_main, found_extern_crate, found_macro);
}
};

loop {
match parser.parse_item(ForceCollect::No) {
Expand Down Expand Up @@ -280,16 +279,15 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool {

let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings();
let psess = ParseSess::with_dcx(dcx, sm);
let mut parser =
match new_parser_from_source_str(&psess, filename, source.to_owned()) {
Ok(p) => p,
Err(errs) => {
errs.into_iter().for_each(|err| err.cancel());
// If there is an unclosed delimiter, an error will be returned by the
// tokentrees.
return false;
}
};
let mut parser = match new_parser_from_source_str(&psess, filename, source.to_owned()) {
Ok(p) => p,
Err(errs) => {
errs.into_iter().for_each(|err| err.cancel());
// If there is an unclosed delimiter, an error will be returned by the
// tokentrees.
return false;
}
};
// If a parsing error happened, it's very likely that the attribute is incomplete.
if let Err(e) = parser.parse_attribute(InnerAttrPolicy::Permitted) {
e.cancel();
Expand Down

0 comments on commit 6aab04e

Please sign in to comment.