// Does not wrap on simple segments.
pub fn rewrite_path(
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
path_context: PathContext,
qself: Option<&ast::QSelf>,
path: &ast::Path,
iter: I,
mut span_lo: BytePos,
span_hi: BytePos,
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
) -> Option<String>
where
}
impl<'a> SegmentParam<'a> {
- fn from_generic_arg(arg: &ast::GenericArg) -> SegmentParam {
+ fn from_generic_arg(arg: &ast::GenericArg) -> SegmentParam<'_> {
match arg {
ast::GenericArg::Lifetime(ref lt) => SegmentParam::LifeTime(lt),
ast::GenericArg::Type(ref ty) => SegmentParam::Type(ty),
+ ast::GenericArg::Const(..) => unreachable!(), // FIXME(#3336)
}
}
}
}
impl<'a> Rewrite for SegmentParam<'a> {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
match *self {
SegmentParam::LifeTime(lt) => lt.rewrite(context, shape),
SegmentParam::Type(ty) => ty.rewrite(context, shape),
segment: &ast::PathSegment,
span_lo: &mut BytePos,
span_hi: BytePos,
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
) -> Option<String> {
let mut result = String::with_capacity(128);
output: &FunctionRetTy,
variadic: bool,
span: Span,
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
) -> Option<String>
where
}
}
-fn type_bound_colon(context: &RewriteContext) -> &'static str {
+fn type_bound_colon(context: &RewriteContext<'_>) -> &'static str {
colon_spaces(
context.config.space_before_colon(),
context.config.space_after_colon(),
}
impl Rewrite for ast::WherePredicate {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
// FIXME: dead spans?
let result = match *self {
ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
}
impl Rewrite for ast::GenericArg {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
match *self {
ast::GenericArg::Lifetime(ref lt) => lt.rewrite(context, shape),
ast::GenericArg::Type(ref ty) => ty.rewrite(context, shape),
+ ast::GenericArg::Const(..) => unreachable!(), // FIXME(#3336)
}
}
}
fn rewrite_bounded_lifetime(
lt: &ast::Lifetime,
bounds: &[ast::GenericBound],
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
) -> Option<String> {
let result = lt.rewrite(context, shape)?;
}
impl Rewrite for ast::Lifetime {
- fn rewrite(&self, context: &RewriteContext, _: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, _: Shape) -> Option<String> {
Some(rewrite_ident(context, self.ident).to_owned())
}
}
impl Rewrite for ast::GenericBound {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
match *self {
ast::GenericBound::Trait(ref poly_trait_ref, trait_bound_modifier) => {
let snippet = context.snippet(self.span());
}
impl Rewrite for ast::GenericBounds {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
if self.is_empty() {
return Some(String::new());
}
}
impl Rewrite for ast::GenericParam {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
let mut result = String::with_capacity(128);
// FIXME: If there are more than one attributes, this will force multiline.
match self.attrs.rewrite(context, shape) {
}
impl Rewrite for ast::PolyTraitRef {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
if let Some(lifetime_str) =
rewrite_lifetime_param(context, shape, &self.bound_generic_params)
{
}
impl Rewrite for ast::TraitRef {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
rewrite_path(context, PathContext::Type, None, &self.path, shape)
}
}
impl Rewrite for ast::Ty {
- fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
+ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String> {
match self.node {
ast::TyKind::TraitObject(ref bounds, tobj_syntax) => {
// we have to consider 'dyn' keyword is used or not!!!
fn rewrite_bare_fn(
bare_fn: &ast::BareFnTy,
span: Span,
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
) -> Option<String> {
debug!("rewrite_bare_fn {:#?}", shape);
}
fn join_bounds(
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
items: &[ast::GenericBound],
need_indent: bool,
Some(result)
}
-pub fn can_be_overflowed_type(context: &RewriteContext, ty: &ast::Ty, len: usize) -> bool {
+pub fn can_be_overflowed_type(context: &RewriteContext<'_>, ty: &ast::Ty, len: usize) -> bool {
match ty.node {
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
ast::TyKind::Rptr(_, ref mutty) | ast::TyKind::Ptr(ref mutty) => {
/// Returns `None` if there is no `LifetimeDef` in the given generic parameters.
fn rewrite_lifetime_param(
- context: &RewriteContext,
+ context: &RewriteContext<'_>,
shape: Shape,
generic_params: &[ast::GenericParam],
) -> Option<String> {