Run RustFmt

This commit is contained in:
jumbatm 2020-02-02 09:47:58 +10:00
parent 0634a50073
commit d246385122
36 changed files with 477 additions and 500 deletions

View file

@ -676,7 +676,8 @@ fn build_diagnostic(
|lint| {
let mut diag = lint.build(&format!("`[{}]` {}", path_str, err_msg));
if let Some(link_range) = link_range {
if let Some(sp) = super::source_span_for_markdown_range(cx, dox, &link_range, attrs) {
if let Some(sp) = super::source_span_for_markdown_range(cx, dox, &link_range, attrs)
{
diag.set_span(sp);
diag.span_label(sp, short_err_msg);
} else {
@ -684,7 +685,8 @@ fn build_diagnostic(
// ^ ~~~~
// | link_range
// last_new_line_offset
let last_new_line_offset = dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
let last_new_line_offset =
dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
// Print the line containing the `link_range` and manually mark it with '^'s.
@ -804,7 +806,8 @@ fn ambiguity_error(
let mut diag = lint.build(&msg);
if let Some(link_range) = link_range {
if let Some(sp) = super::source_span_for_markdown_range(cx, dox, &link_range, attrs) {
if let Some(sp) = super::source_span_for_markdown_range(cx, dox, &link_range, attrs)
{
diag.set_span(sp);
diag.span_label(sp, "ambiguous link");
@ -851,7 +854,8 @@ fn ambiguity_error(
// ^ ~~~~
// | link_range
// last_new_line_offset
let last_new_line_offset = dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
let last_new_line_offset =
dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
// Print the line containing the `link_range` and manually mark it with '^'s.
@ -868,7 +872,6 @@ fn ambiguity_error(
diag.emit();
},
);
}
/// Given an enum variant's res, return the res of its enum and the associated fragment.

View file

@ -342,12 +342,9 @@ pub fn look_for_tests<'tcx>(
if check_missing_code == true && tests.found_tests == 0 {
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
cx.tcx.struct_span_lint_hir(
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
hir_id,
sp,
|lint| lint.build("missing code example in this documentation").emit(),
);
cx.tcx.struct_span_lint_hir(lint::builtin::MISSING_DOC_CODE_EXAMPLES, hir_id, sp, |lint| {
lint.build("missing code example in this documentation").emit()
});
} else if check_missing_code == false
&& tests.found_tests > 0
&& !cx.renderinfo.borrow().access_levels.is_public(item.def_id)