diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-03-28 10:58:41 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-03-28 10:58:41 +1300 |
| commit | e4efa22983a676fc78dafc3d39ff81f062e72120 (patch) | |
| tree | 905ca22de6e7a4a395d7128290b8c71821c93cec /src/types.rs | |
| parent | 038436919d762bf6fbdd87ce4e824f8c8c0c8822 (diff) | |
Source formatting fallout
Diffstat (limited to 'src/types.rs')
| -rw-r--r-- | src/types.rs | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/types.rs b/src/types.rs index ba6852dbe84..9cac8b4a0e0 100644 --- a/src/types.rs +++ b/src/types.rs @@ -206,7 +206,8 @@ fn rewrite_segment(path_context: PathContext, .chain(data.bindings.iter().map(|x| SegmentParam::Binding(&*x))) .collect::<Vec<_>>(); - let next_span_lo = param_list.last() + let next_span_lo = param_list + .last() .unwrap() .get_span() .hi + BytePos(1); @@ -297,28 +298,28 @@ fn format_function_type<'a, I>(inputs: I, // 1 for ( let offset = shape.indent + 1; let list_lo = context.codemap.span_after(span, "("); - let items = itemize_list(context.codemap, - // FIXME Would be nice to avoid this allocation, - // but I couldn't get the types to work out. - inputs.map(|i| ArgumentKind::Regular(Box::new(i))) - .chain(variadic_arg), - ")", - |arg| match *arg { - ArgumentKind::Regular(ref ty) => ty.span().lo, - ArgumentKind::Variadic(start) => start, - }, - |arg| match *arg { - ArgumentKind::Regular(ref ty) => ty.span().hi, - ArgumentKind::Variadic(start) => start + BytePos(3), - }, - |arg| match *arg { - ArgumentKind::Regular(ref ty) => { - ty.rewrite(context, Shape::legacy(budget, offset)) - } - ArgumentKind::Variadic(_) => Some("...".to_owned()), - }, - list_lo, - span.hi); + let items = + itemize_list(context.codemap, + // FIXME Would be nice to avoid this allocation, + // but I couldn't get the types to work out. + inputs.map(|i| ArgumentKind::Regular(Box::new(i))).chain(variadic_arg), + ")", + |arg| match *arg { + ArgumentKind::Regular(ref ty) => ty.span().lo, + ArgumentKind::Variadic(start) => start, + }, + |arg| match *arg { + ArgumentKind::Regular(ref ty) => ty.span().hi, + ArgumentKind::Variadic(start) => start + BytePos(3), + }, + |arg| match *arg { + ArgumentKind::Regular(ref ty) => { + ty.rewrite(context, Shape::legacy(budget, offset)) + } + ArgumentKind::Variadic(_) => Some("...".to_owned()), + }, + list_lo, + span.hi); let list_str = try_opt!(format_fn_args(items, Shape::legacy(budget, offset), context.config)); @@ -680,7 +681,8 @@ fn rewrite_bare_fn(bare_fn: &ast::BareFnTy, // 6 = "for<> ".len(), 4 = "for<". // This doesn't work out so nicely for mutliline situation with lots of // rightward drift. If that is a problem, we could use the list stuff. - result.push_str(&try_opt!(bare_fn.lifetimes + result.push_str(&try_opt!(bare_fn + .lifetimes .iter() .map(|l| { l.rewrite(context, |
