Remove unnecessary references

This commit is contained in:
topecongiro 2017-09-15 17:09:30 +09:00
parent ed2687f33b
commit 0b5d524486
4 changed files with 11 additions and 11 deletions

View File

@ -294,7 +294,7 @@ pub fn format_expr(
Some(format!(
"{}{}",
"do catch ",
try_opt!(block.rewrite(&context, Shape::legacy(budget, shape.indent)))
try_opt!(block.rewrite(context, Shape::legacy(budget, shape.indent)))
))
}
}
@ -3004,17 +3004,17 @@ impl<'a> ToExpr for ast::StructField {
impl<'a> ToExpr for MacroArg {
fn to_expr(&self) -> Option<&ast::Expr> {
match self {
&MacroArg::Expr(ref expr) => Some(expr),
match *self {
MacroArg::Expr(ref expr) => Some(expr),
_ => None,
}
}
fn can_be_overflowed(&self, context: &RewriteContext, len: usize) -> bool {
match self {
&MacroArg::Expr(ref expr) => can_be_overflowed_expr(context, expr, len),
&MacroArg::Ty(ref ty) => can_be_overflowed_type(context, ty, len),
&MacroArg::Pat(..) => false,
match *self {
MacroArg::Expr(ref expr) => can_be_overflowed_expr(context, expr, len),
MacroArg::Ty(ref ty) => can_be_overflowed_type(context, ty, len),
MacroArg::Pat(..) => false,
}
}
}

View File

@ -330,7 +330,7 @@ impl<'a> FmtVisitor<'a> {
""
};
format_expr(&e, ExprType::Statement, &self.get_context(), self.shape())
format_expr(e, ExprType::Statement, &self.get_context(), self.shape())
.map(|s| s + suffix)
.or_else(|| Some(self.snippet(e.span)))
}

View File

@ -114,7 +114,7 @@ pub struct ListItem {
impl ListItem {
pub fn inner_as_ref(&self) -> &str {
self.item.as_ref().map_or("", |s| &*s)
self.item.as_ref().map_or("", |s| s)
}
pub fn is_different_group(&self) -> bool {

View File

@ -340,7 +340,7 @@ impl<'a> FmtVisitor<'a> {
}
match item.node {
ast::ItemKind::Use(ref vp) => self.format_import(&item, vp),
ast::ItemKind::Use(ref vp) => self.format_import(item, vp),
ast::ItemKind::Impl(..) => {
let snippet = self.snippet(item.span);
let where_span_end = snippet
@ -381,7 +381,7 @@ impl<'a> FmtVisitor<'a> {
}
ast::ItemKind::Mod(ref module) => {
self.format_missing_with_indent(source!(self, item.span).lo());
self.format_mod(module, &item.vis, item.span, item.ident, &attrs);
self.format_mod(module, &item.vis, item.span, item.ident, attrs);
}
ast::ItemKind::Mac(ref mac) => {
self.visit_mac(mac, Some(item.ident), MacroPosition::Item);