diff options
| author | Hirochika Matsumoto <matsujika@gmail.com> | 2020-09-23 03:48:15 +0900 |
|---|---|---|
| committer | Hirochika Matsumoto <matsujika@gmail.com> | 2020-11-18 01:28:37 +0900 |
| commit | a433d4690e04c8c8eceb1f59c78fded1f04cf6f0 (patch) | |
| tree | 50a9b1ba66de6ad1eb3fa2e7c1d3a2f8ae84f0e7 | |
| parent | c77585672720285db5180b2ee4207c7ee9b51072 (diff) | |
| download | rust-a433d4690e04c8c8eceb1f59c78fded1f04cf6f0.tar.gz rust-a433d4690e04c8c8eceb1f59c78fded1f04cf6f0.zip | |
Run rustfmt
| -rw-r--r-- | clippy_lints/src/unnecessary_wrap.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/clippy_lints/src/unnecessary_wrap.rs b/clippy_lints/src/unnecessary_wrap.rs index d581912284f..1c8a08172a3 100644 --- a/clippy_lints/src/unnecessary_wrap.rs +++ b/clippy_lints/src/unnecessary_wrap.rs @@ -1,7 +1,4 @@ -use crate::utils::{ - is_type_diagnostic_item, match_qpath, paths, return_ty, snippet, - span_lint_and_then, -}; +use crate::utils::{is_type_diagnostic_item, match_qpath, paths, return_ty, snippet, span_lint_and_then}; use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir::intravisit::{FnKind, Visitor}; @@ -104,17 +101,20 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWrap { move |diag| { diag.multipart_suggestion( "factor this out to", - suggs.into_iter().chain({ - let inner_ty = return_ty(cx, hir_id) - .walk() - .skip(1) // skip `std::option::Option` or `std::result::Result` - .take(1) // take the first outermost inner type - .filter_map(|inner| match inner.unpack() { - GenericArgKind::Type(inner_ty) => Some(inner_ty.to_string()), - _ => None, - }); - inner_ty.map(|inner_ty| (fn_decl.output.span(), inner_ty)) - }).collect(), + suggs + .into_iter() + .chain({ + let inner_ty = return_ty(cx, hir_id) + .walk() + .skip(1) // skip `std::option::Option` or `std::result::Result` + .take(1) // take the first outermost inner type + .filter_map(|inner| match inner.unpack() { + GenericArgKind::Type(inner_ty) => Some(inner_ty.to_string()), + _ => None, + }); + inner_ty.map(|inner_ty| (fn_decl.output.span(), inner_ty)) + }) + .collect(), Applicability::MachineApplicable, ); }, |
