mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-01 07:13:24 +03:00
Format source codes
This commit is contained in:
+1
-2
@@ -3035,8 +3035,7 @@ fn to_expr(&self) -> Option<&ast::Expr> {
|
||||
None
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn can_be_overflowed(&self, context: &RewriteContext, len: usize) -> bool {
|
||||
fn can_be_overflowed(&self, _: &RewriteContext, _: usize) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -167,7 +167,9 @@ pub fn intersects_range(&self, file_name: &str, lo: usize, hi: usize) -> bool {
|
||||
}
|
||||
|
||||
/// 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 @@ pub struct Writebatch<K: Key> {
|
||||
|
||||
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 @@ struct X<T>
|
||||
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 @@ fn foo() -> Box<Write + 'static>
|
||||
|
||||
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(
|
||||
|
||||
+19
-4
@@ -41,7 +41,11 @@ pub struct Writebatch<K: Key> {
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user