From 4bb90f5cc8e0347534436612f45a3c22c7e265bb Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Sat, 9 Feb 2019 16:14:30 +0900 Subject: Fix rust_2018_idioms warnings --- src/utils.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index 06f1ca2d8d8..9c70ef7d975 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -30,7 +30,7 @@ use crate::shape::{Indent, Shape}; pub const DEPR_SKIP_ANNOTATION: &str = "rustfmt_skip"; pub const SKIP_ANNOTATION: &str = "rustfmt::skip"; -pub fn rewrite_ident<'a>(context: &'a RewriteContext, ident: ast::Ident) -> &'a str { +pub fn rewrite_ident<'a>(context: &'a RewriteContext<'_>, ident: ast::Ident) -> &'a str { context.snippet(ident.span) } @@ -64,7 +64,7 @@ pub fn is_same_visibility(a: &Visibility, b: &Visibility) -> bool { } // Uses Cow to avoid allocating in the common cases. -pub fn format_visibility(context: &RewriteContext, vis: &Visibility) -> Cow<'static, str> { +pub fn format_visibility(context: &RewriteContext<'_>, vis: &Visibility) -> Cow<'static, str> { match vis.node { VisibilityKind::Public => Cow::from("pub "), VisibilityKind::Inherited => Cow::from(""), @@ -267,7 +267,7 @@ pub fn contains_skip(attrs: &[Attribute]) -> bool { } #[inline] -pub fn semicolon_for_expr(context: &RewriteContext, expr: &ast::Expr) -> bool { +pub fn semicolon_for_expr(context: &RewriteContext<'_>, expr: &ast::Expr) -> bool { match expr.node { ast::ExprKind::Ret(..) | ast::ExprKind::Continue(..) | ast::ExprKind::Break(..) => { context.config.trailing_semicolon() @@ -277,7 +277,7 @@ pub fn semicolon_for_expr(context: &RewriteContext, expr: &ast::Expr) -> bool { } #[inline] -pub fn semicolon_for_stmt(context: &RewriteContext, stmt: &ast::Stmt) -> bool { +pub fn semicolon_for_stmt(context: &RewriteContext<'_>, stmt: &ast::Stmt) -> bool { match stmt.node { ast::StmtKind::Semi(ref expr) => match expr.node { ast::ExprKind::While(..) @@ -424,7 +424,7 @@ pub fn first_line_ends_with(s: &str, c: char) -> bool { // States whether an expression's last line exclusively consists of closing // parens, braces, and brackets in its idiomatic formatting. -pub fn is_block_expr(context: &RewriteContext, expr: &ast::Expr, repr: &str) -> bool { +pub fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr: &str) -> bool { match expr.node { ast::ExprKind::Mac(..) | ast::ExprKind::Call(..) -- cgit 1.4.1-3-g733a5