Format source codes
This commit is contained in:
parent
f8586bac2a
commit
6a7f866cfe
@ -3035,8 +3035,7 @@ impl<'a> ToExpr for ast::StructField {
|
||||
None
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn can_be_overflowed(&self, context: &RewriteContext, len: usize) -> bool {
|
||||
fn can_be_overflowed(&self, _: &RewriteContext, _: usize) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,9 @@ impl FileLines {
|
||||
}
|
||||
|
||||
/// FileLines files iterator.
|
||||
pub struct Files<'a>(Option<::std::collections::hash_map::Keys<'a, String, Vec<Range>>>);
|
||||
pub struct Files<'a>(
|
||||
Option<::std::collections::hash_map::Keys<'a, String, Vec<Range>>>,
|
||||
);
|
||||
|
||||
impl<'a> iter::Iterator for Files<'a> {
|
||||
type Item = &'a String;
|
||||
|
@ -1419,6 +1419,11 @@ fn rewrite_struct_field_type(
|
||||
.map(|ty| format!("{}{}", spacing, ty))
|
||||
}
|
||||
|
||||
impl Rewrite for ast::StructField {
|
||||
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
||||
rewrite_struct_field(context, self, shape, 0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rewrite_struct_field(
|
||||
context: &RewriteContext,
|
||||
|
@ -73,14 +73,19 @@ struct Bar;
|
||||
|
||||
struct NewType(Type, OtherType);
|
||||
|
||||
struct NewInt<T: Copy>(pub i32, SomeType /* inline comment */, T /* sup */);
|
||||
struct NewInt<T: Copy>(
|
||||
pub i32,
|
||||
SomeType, // inline comment
|
||||
T, // sup
|
||||
);
|
||||
|
||||
struct Qux<'a,
|
||||
N: Clone + 'a,
|
||||
E: Clone + 'a,
|
||||
G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
|
||||
W: Write + Copy>
|
||||
(
|
||||
struct Qux<
|
||||
'a,
|
||||
N: Clone + 'a,
|
||||
E: Clone + 'a,
|
||||
G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
|
||||
W: Write + Copy,
|
||||
>(
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Comment
|
||||
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
|
||||
#[AnAttr]
|
||||
@ -94,7 +99,7 @@ struct Tuple(
|
||||
// Comment 1
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
||||
// Comment 2
|
||||
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
|
||||
);
|
||||
|
||||
// With a where clause and generics.
|
||||
@ -139,7 +144,10 @@ struct Baz {
|
||||
}
|
||||
|
||||
// Will this be a one-liner?
|
||||
struct Tuple(A /* Comment */, B);
|
||||
struct Tuple(
|
||||
A, // Comment
|
||||
B,
|
||||
);
|
||||
|
||||
pub struct State<F: FnMut() -> time::Timespec> {
|
||||
now: F,
|
||||
@ -186,19 +194,27 @@ struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUU
|
||||
UUUUUUUUUUUUUUUUUUU,
|
||||
);
|
||||
struct Foo<T>(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT)
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
)
|
||||
where
|
||||
T: PartialEq;
|
||||
struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTTTT)
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTTTT,
|
||||
)
|
||||
where
|
||||
T: PartialEq;
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUU
|
||||
UUUUUUUUUUUUUUUUUUU,
|
||||
)
|
||||
where
|
||||
T: PartialEq;
|
||||
@ -208,7 +224,7 @@ struct Foo<T>(
|
||||
// Baz
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
// Qux (FIXME #572 - doc comment)
|
||||
UUUUUUUUUUUUUUUUUUU
|
||||
UUUUUUUUUUUUUUUUUUU,
|
||||
);
|
||||
|
||||
mod m {
|
||||
@ -223,7 +239,7 @@ mod m {
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
/// Qux
|
||||
UUUUUUUUUUUUUUUUUUU
|
||||
UUUUUUUUUUUUUUUUUUU,
|
||||
);
|
||||
|
||||
struct Issue677 {
|
||||
|
@ -29,7 +29,7 @@ fn main() {
|
||||
kaas!(
|
||||
// comments
|
||||
a, // post macro
|
||||
b /* another */
|
||||
b // another
|
||||
);
|
||||
|
||||
trailingcomma!(a, b, c,);
|
||||
|
@ -40,7 +40,7 @@ where
|
||||
|
||||
fn baz<
|
||||
'a: 'b, // comment on 'a
|
||||
T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType, /* comment on T */
|
||||
T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType, // comment on T
|
||||
>(
|
||||
a: A,
|
||||
b: B, // comment on b
|
||||
|
@ -14,7 +14,10 @@ fn main() {
|
||||
supports_clipboard,
|
||||
);
|
||||
|
||||
Quux::<ParamOne /* Comment 1 */, ParamTwo /* Comment 2 */>::some_func();
|
||||
Quux::<
|
||||
ParamOne, // Comment 1
|
||||
ParamTwo, // Comment 2
|
||||
>::some_func();
|
||||
|
||||
<*mut JSObject>::relocate(entry);
|
||||
|
||||
|
@ -10,7 +10,7 @@ fn foo() {
|
||||
// Comment
|
||||
foo(), // Comment
|
||||
// Comment
|
||||
bar(), /* Comment */
|
||||
bar(), // Comment
|
||||
);
|
||||
|
||||
Foo(Bar, f());
|
||||
@ -24,7 +24,7 @@ fn foo() {
|
||||
|
||||
Baz(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
||||
zzzzz, /* test */
|
||||
zzzzz, // test
|
||||
);
|
||||
|
||||
A(
|
||||
|
@ -41,7 +41,11 @@ struct Bar;
|
||||
|
||||
struct NewType(Type, OtherType);
|
||||
|
||||
struct NewInt<T: Copy>(pub i32, SomeType /* inline comment */, T /* sup */);
|
||||
struct NewInt<T: Copy>(
|
||||
pub i32,
|
||||
SomeType, // inline comment
|
||||
T, // sup
|
||||
);
|
||||
|
||||
struct Qux<
|
||||
'a,
|
||||
@ -108,7 +112,10 @@ struct Baz {
|
||||
}
|
||||
|
||||
// Will this be a one-liner?
|
||||
struct Tuple(A /* Comment */, B);
|
||||
struct Tuple(
|
||||
A, // Comment
|
||||
B,
|
||||
);
|
||||
|
||||
pub struct State<F: FnMut() -> time::Timespec> {
|
||||
now: F,
|
||||
@ -157,10 +164,18 @@ struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUU,
|
||||
);
|
||||
struct Foo<T>(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT)
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTT,
|
||||
)
|
||||
where
|
||||
T: PartialEq;
|
||||
struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTTTT)
|
||||
struct Foo<T>(
|
||||
TTTTTTTTTTTTTTTTT,
|
||||
UUUUUUUUUUUUUUUUUUUUUUUU,
|
||||
TTTTTTTTTTTTTTTTTTTTT,
|
||||
)
|
||||
where
|
||||
T: PartialEq;
|
||||
struct Foo<T>(
|
||||
|
@ -48,10 +48,7 @@ struct Pair<
|
||||
|
||||
struct TupPair<
|
||||
S, T,
|
||||
>(
|
||||
S,
|
||||
T,
|
||||
)
|
||||
>(S, T,)
|
||||
where
|
||||
T: P,
|
||||
S: P + Q;
|
||||
|
Loading…
x
Reference in New Issue
Block a user