mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +00:00
Remove unnecessary references
This commit is contained in:
parent
ed2687f33b
commit
0b5d524486
14
src/expr.rs
14
src/expr.rs
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)))
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user