mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Format source codes
This commit is contained in:
parent
a91fd699a0
commit
0614e94d0d
18
src/expr.rs
18
src/expr.rs
@ -1230,10 +1230,10 @@ fn rewrite_match(context: &RewriteContext,
|
|||||||
|
|
||||||
fn arm_start_pos(arm: &ast::Arm) -> BytePos {
|
fn arm_start_pos(arm: &ast::Arm) -> BytePos {
|
||||||
let &ast::Arm {
|
let &ast::Arm {
|
||||||
ref attrs,
|
ref attrs,
|
||||||
ref pats,
|
ref pats,
|
||||||
..
|
..
|
||||||
} = arm;
|
} = arm;
|
||||||
if !attrs.is_empty() {
|
if !attrs.is_empty() {
|
||||||
return attrs[0].span.lo;
|
return attrs[0].span.lo;
|
||||||
}
|
}
|
||||||
@ -1264,11 +1264,11 @@ impl Rewrite for ast::Arm {
|
|||||||
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
||||||
debug!("Arm::rewrite {:?} {:?}", self, shape);
|
debug!("Arm::rewrite {:?} {:?}", self, shape);
|
||||||
let &ast::Arm {
|
let &ast::Arm {
|
||||||
ref attrs,
|
ref attrs,
|
||||||
ref pats,
|
ref pats,
|
||||||
ref guard,
|
ref guard,
|
||||||
ref body,
|
ref body,
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
// FIXME this is all a bit grotty, would be nice to abstract out the
|
// FIXME this is all a bit grotty, would be nice to abstract out the
|
||||||
// treatment of attributes.
|
// treatment of attributes.
|
||||||
|
@ -133,9 +133,9 @@ fn rewrite_view_path_prefix(path: &ast::Path,
|
|||||||
let path_str = if path.segments.last().unwrap().identifier.to_string() == "self" &&
|
let path_str = if path.segments.last().unwrap().identifier.to_string() == "self" &&
|
||||||
path.segments.len() > 1 {
|
path.segments.len() > 1 {
|
||||||
let path = &ast::Path {
|
let path = &ast::Path {
|
||||||
span: path.span.clone(),
|
span: path.span.clone(),
|
||||||
segments: path.segments[..path.segments.len() - 1].to_owned(),
|
segments: path.segments[..path.segments.len() - 1].to_owned(),
|
||||||
};
|
};
|
||||||
try_opt!(rewrite_path(context, PathContext::Import, None, path, shape))
|
try_opt!(rewrite_path(context, PathContext::Import, None, path, shape))
|
||||||
} else {
|
} else {
|
||||||
try_opt!(rewrite_path(context, PathContext::Import, None, path, shape))
|
try_opt!(rewrite_path(context, PathContext::Import, None, path, shape))
|
||||||
|
@ -74,16 +74,16 @@ fn issue863() {
|
|||||||
|
|
||||||
fn issue934() {
|
fn issue934() {
|
||||||
let hash: &Fn(&&Block) -> u64 = &|block| -> u64 {
|
let hash: &Fn(&&Block) -> u64 = &|block| -> u64 {
|
||||||
let mut h = SpanlessHash::new(cx);
|
let mut h = SpanlessHash::new(cx);
|
||||||
h.hash_block(block);
|
h.hash_block(block);
|
||||||
h.finish()
|
h.finish()
|
||||||
};
|
};
|
||||||
|
|
||||||
let hash: &Fn(&&Block) -> u64 = &|block| -> u64 {
|
let hash: &Fn(&&Block) -> u64 = &|block| -> u64 {
|
||||||
let mut h = SpanlessHash::new(cx);
|
let mut h = SpanlessHash::new(cx);
|
||||||
h.hash_block(block);
|
h.hash_block(block);
|
||||||
h.finish();
|
h.finish();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
||||||
|
Loading…
Reference in New Issue
Block a user