Run rustfmt

This commit is contained in:
Hirochika Matsumoto 2020-09-23 03:48:15 +09:00
parent c775856727
commit a433d4690e

View File

@ -1,7 +1,4 @@
use crate::utils::{ use crate::utils::{is_type_diagnostic_item, match_qpath, paths, return_ty, snippet, span_lint_and_then};
is_type_diagnostic_item, match_qpath, paths, return_ty, snippet,
span_lint_and_then,
};
use if_chain::if_chain; use if_chain::if_chain;
use rustc_errors::Applicability; use rustc_errors::Applicability;
use rustc_hir::intravisit::{FnKind, Visitor}; use rustc_hir::intravisit::{FnKind, Visitor};
@ -104,17 +101,20 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWrap {
move |diag| { move |diag| {
diag.multipart_suggestion( diag.multipart_suggestion(
"factor this out to", "factor this out to",
suggs.into_iter().chain({ suggs
let inner_ty = return_ty(cx, hir_id) .into_iter()
.walk() .chain({
.skip(1) // skip `std::option::Option` or `std::result::Result` let inner_ty = return_ty(cx, hir_id)
.take(1) // take the first outermost inner type .walk()
.filter_map(|inner| match inner.unpack() { .skip(1) // skip `std::option::Option` or `std::result::Result`
GenericArgKind::Type(inner_ty) => Some(inner_ty.to_string()), .take(1) // take the first outermost inner type
_ => None, .filter_map(|inner| match inner.unpack() {
}); GenericArgKind::Type(inner_ty) => Some(inner_ty.to_string()),
inner_ty.map(|inner_ty| (fn_decl.output.span(), inner_ty)) _ => None,
}).collect(), });
inner_ty.map(|inner_ty| (fn_decl.output.span(), inner_ty))
})
.collect(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
}, },