2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2015-11-09 13:03:01 -06:00
|
|
|
// rustfmt-wrap_comments: true
|
2015-07-02 15:40:20 -05:00
|
|
|
// Test expressions
|
|
|
|
|
|
|
|
fn foo() -> bool {
|
2015-07-23 16:08:41 -05:00
|
|
|
let boxed: Box<i32> = box 5;
|
|
|
|
let referenced = &5;
|
|
|
|
|
2015-07-02 15:40:20 -05:00
|
|
|
let very_long_variable_name = (a + first + simple + test);
|
2017-07-05 04:31:37 -05:00
|
|
|
let very_long_variable_name =
|
|
|
|
(a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB + b + c);
|
2015-07-02 15:40:20 -05:00
|
|
|
|
2017-07-05 04:31:37 -05:00
|
|
|
let is_internalxxxx =
|
2018-08-23 16:10:46 -05:00
|
|
|
self.source_map.span_to_filename(s) == self.source_map.span_to_filename(m.inner);
|
2015-07-24 08:29:04 -05:00
|
|
|
|
2017-09-14 22:20:58 -05:00
|
|
|
let some_val = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbb
|
2018-07-05 18:58:22 -05:00
|
|
|
/ (bbbbbb - function_call(x, *very_long_pointer, y))
|
|
|
|
+ 1000;
|
2015-07-02 15:40:20 -05:00
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
some_ridiculously_loooooooooooooooooooooong_function(
|
|
|
|
10000 * 30000000000 + 40000 / 1002200000000 - 50000 * sqrt(-1),
|
|
|
|
trivial_value,
|
|
|
|
);
|
2018-05-06 01:14:47 -05:00
|
|
|
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
2018-07-12 05:21:07 -05:00
|
|
|
+ a
|
|
|
|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
2018-05-06 01:14:47 -05:00
|
|
|
+ aaaaa);
|
2015-07-19 16:42:54 -05:00
|
|
|
|
2015-07-20 16:29:25 -05:00
|
|
|
{
|
2015-08-15 23:13:55 -05:00
|
|
|
for _ in 0..10 {}
|
2015-07-20 16:29:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
2015-08-15 23:13:55 -05:00
|
|
|
{}
|
2015-07-20 16:29:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-19 16:42:54 -05:00
|
|
|
if 1 + 2 > 0 {
|
|
|
|
let result = 5;
|
|
|
|
result
|
|
|
|
} else {
|
|
|
|
4
|
2015-11-08 18:23:19 -06:00
|
|
|
};
|
2015-07-19 16:42:54 -05:00
|
|
|
|
2015-07-19 15:25:44 -05:00
|
|
|
if let Some(x) = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
|
|
|
|
// Nothing
|
|
|
|
}
|
|
|
|
|
2017-07-09 12:25:26 -05:00
|
|
|
if let Some(x) =
|
|
|
|
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
|
2017-06-11 23:01:41 -05:00
|
|
|
{}
|
2015-07-19 15:25:44 -05:00
|
|
|
|
2017-06-15 02:26:46 -05:00
|
|
|
if let (
|
|
|
|
some_very_large,
|
|
|
|
tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple,
|
|
|
|
) = 1 + 2 + 3
|
|
|
|
{}
|
2015-07-19 15:25:44 -05:00
|
|
|
|
2017-06-15 02:26:46 -05:00
|
|
|
if let (
|
|
|
|
some_very_large,
|
|
|
|
tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple,
|
|
|
|
) = 1111 + 2222
|
2017-06-11 23:01:41 -05:00
|
|
|
{}
|
2015-07-19 15:25:44 -05:00
|
|
|
|
2017-06-15 02:26:46 -05:00
|
|
|
if let (
|
|
|
|
some_very_large,
|
|
|
|
tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple,
|
|
|
|
) = 1 + 2 + 3
|
2017-06-11 23:01:41 -05:00
|
|
|
{}
|
2015-07-20 16:29:25 -05:00
|
|
|
|
2017-11-20 17:50:55 -06:00
|
|
|
if let ast::ItemKind::Trait(_, unsafety, ref generics, ref type_param_bounds, ref trait_items) =
|
|
|
|
item.node
|
|
|
|
{
|
|
|
|
// nothing
|
|
|
|
}
|
|
|
|
|
2016-05-29 10:58:38 -05:00
|
|
|
let test = if true { 5 } else { 3 };
|
2015-08-25 14:46:58 -05:00
|
|
|
|
2015-07-19 16:42:54 -05:00
|
|
|
if cond() {
|
|
|
|
something();
|
|
|
|
} else if different_cond() {
|
|
|
|
something_else();
|
|
|
|
} else {
|
|
|
|
// Check subformatting
|
2017-09-14 22:20:58 -05:00
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
|
|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
2015-07-19 16:42:54 -05:00
|
|
|
}
|
2018-08-03 19:59:19 -05:00
|
|
|
|
|
|
|
// #2884
|
|
|
|
let _ = [0; {
|
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
|
|
const fn get(&self) -> usize {
|
|
|
|
5
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Foo.get()
|
|
|
|
}];
|
2015-07-02 15:40:20 -05:00
|
|
|
}
|
2015-07-20 16:29:25 -05:00
|
|
|
|
|
|
|
fn bar() {
|
2017-07-05 04:31:37 -05:00
|
|
|
let range =
|
|
|
|
(111111111 + 333333333333333333 + 1111 + 400000000000000000)..(2222 + 2333333333333333);
|
2015-07-20 16:29:25 -05:00
|
|
|
|
|
|
|
let another_range = 5..some_func(a, b /* comment */);
|
|
|
|
|
|
|
|
for _ in 1.. {
|
|
|
|
call_forever();
|
|
|
|
}
|
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
syntactically_correct(
|
|
|
|
loop {
|
|
|
|
sup('?');
|
|
|
|
},
|
|
|
|
if cond { 0 } else { 1 },
|
|
|
|
);
|
2015-07-20 16:29:25 -05:00
|
|
|
|
|
|
|
let third = ..10;
|
|
|
|
let infi_range = ..;
|
|
|
|
let foo = 1..;
|
|
|
|
let bar = 5;
|
|
|
|
let nonsense = (10..0)..(0..10);
|
2015-07-25 16:28:31 -05:00
|
|
|
|
2015-09-03 13:15:24 -05:00
|
|
|
loop {
|
|
|
|
if true {
|
2015-10-13 01:17:51 -05:00
|
|
|
break;
|
2015-09-03 13:15:24 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
let x = (
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
a,
|
|
|
|
);
|
2015-07-02 15:40:20 -05:00
|
|
|
}
|
2015-08-01 07:22:31 -05:00
|
|
|
|
|
|
|
fn baz() {
|
|
|
|
unsafe /* {}{}{}{{{{}} */ {
|
|
|
|
let foo = 1u32;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
|
|
|
* comment */ {
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe /* So this is a very long comment.
|
|
|
|
* Multi-line, too.
|
|
|
|
* Will it still format correctly? */ {
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
// Regular unsafe block
|
|
|
|
}
|
2015-09-05 01:26:28 -05:00
|
|
|
|
|
|
|
unsafe { foo() }
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
foo();
|
|
|
|
}
|
2017-12-18 18:41:05 -06:00
|
|
|
|
|
|
|
// #2289
|
|
|
|
let identifier_0 = unsafe { this_is_58_chars_long_and_line_is_93_chars_long_xxxxxxxxxx };
|
|
|
|
let identifier_1 = unsafe { this_is_59_chars_long_and_line_is_94_chars_long_xxxxxxxxxxx };
|
|
|
|
let identifier_2 = unsafe { this_is_65_chars_long_and_line_is_100_chars_long_xxxxxxxxxxxxxxxx };
|
|
|
|
let identifier_3 =
|
|
|
|
unsafe { this_is_66_chars_long_and_line_is_101_chars_long_xxxxxxxxxxxxxxxxx };
|
2015-08-01 07:22:31 -05:00
|
|
|
}
|
2015-08-15 23:13:55 -05:00
|
|
|
|
|
|
|
// Test some empty blocks.
|
|
|
|
fn qux() {
|
|
|
|
{}
|
|
|
|
// FIXME this one could be done better.
|
2017-01-15 21:37:58 -06:00
|
|
|
{ /* a block with a comment */ }
|
|
|
|
{}
|
2015-08-15 23:13:55 -05:00
|
|
|
{
|
|
|
|
// A block with a comment.
|
|
|
|
}
|
|
|
|
}
|
2015-08-31 12:15:40 -05:00
|
|
|
|
|
|
|
fn issue227() {
|
|
|
|
{
|
2017-06-11 23:01:41 -05:00
|
|
|
let handler =
|
|
|
|
box DocumentProgressHandler::new(addr, DocumentProgressTask::DOMContentLoaded);
|
2015-08-31 12:15:40 -05:00
|
|
|
}
|
|
|
|
}
|
2015-09-11 16:32:13 -05:00
|
|
|
|
|
|
|
fn issue184(source: &str) {
|
|
|
|
for c in source.chars() {
|
|
|
|
if index < 'a' {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-09-11 17:06:17 -05:00
|
|
|
|
|
|
|
fn arrays() {
|
2017-06-11 23:01:41 -05:00
|
|
|
let x = [
|
2017-12-03 21:05:16 -06:00
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 7, 8, 9, 0, 1, 2, 3, 4, 5,
|
|
|
|
6, 7, 8, 9, 0,
|
2017-06-11 23:01:41 -05:00
|
|
|
];
|
|
|
|
|
2017-08-27 00:41:30 -05:00
|
|
|
let y = [/* comment */ 1, 2 /* post comment */, 3];
|
2017-06-11 23:01:41 -05:00
|
|
|
|
|
|
|
let xy = [
|
|
|
|
strukt {
|
|
|
|
test123: value_one_two_three_four,
|
|
|
|
turbo: coolio(),
|
|
|
|
},
|
|
|
|
// comment
|
|
|
|
1,
|
|
|
|
];
|
|
|
|
|
2017-06-28 21:01:22 -05:00
|
|
|
let a = WeightedChoice::new(&mut [
|
|
|
|
Weighted {
|
|
|
|
weightweight: x,
|
|
|
|
item: 0,
|
|
|
|
},
|
|
|
|
Weighted {
|
|
|
|
weightweight: 1,
|
|
|
|
item: 1,
|
|
|
|
},
|
|
|
|
Weighted {
|
|
|
|
weightweight: x,
|
|
|
|
item: 2,
|
|
|
|
},
|
|
|
|
Weighted {
|
|
|
|
weightweight: 1,
|
|
|
|
item: 3,
|
|
|
|
},
|
|
|
|
]);
|
2017-06-11 23:01:41 -05:00
|
|
|
|
|
|
|
let z = [
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
yyyyyyyyyyyyyyyyyyyyyyyyyyy,
|
|
|
|
zzzzzzzzzzzzzzzzzz,
|
|
|
|
q,
|
|
|
|
];
|
2015-09-11 17:06:17 -05:00
|
|
|
|
|
|
|
[1 + 3, 4, 5, 6, 7, 7, fncall::<Vec<_>>(3 - 1)]
|
|
|
|
}
|
2015-09-24 00:51:37 -05:00
|
|
|
|
|
|
|
fn returns() {
|
2017-09-14 22:20:58 -05:00
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
|
|
&& return;
|
2015-09-24 00:51:37 -05:00
|
|
|
|
2017-09-14 22:20:58 -05:00
|
|
|
return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
|
|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
|
2015-09-24 00:51:37 -05:00
|
|
|
}
|
2015-09-24 03:13:57 -05:00
|
|
|
|
|
|
|
fn addrof() {
|
2017-09-14 22:20:58 -05:00
|
|
|
&mut (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
|
|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
|
|
|
|
&(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
|
|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
|
2015-09-24 03:13:57 -05:00
|
|
|
}
|
2015-10-02 04:31:40 -05:00
|
|
|
|
|
|
|
fn casts() {
|
|
|
|
fn unpack(packed: u32) -> [u16; 2] {
|
|
|
|
[(packed >> 16) as u16, (packed >> 0) as u16]
|
|
|
|
}
|
|
|
|
|
|
|
|
let some_trait_xxx = xxxxxxxxxxx + xxxxxxxxxxxxx as SomeTraitXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;
|
2017-07-05 04:31:37 -05:00
|
|
|
let slightly_longer_trait =
|
|
|
|
yyyyyyyyy + yyyyyyyyyyy as SomeTraitYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY;
|
2015-10-02 04:31:40 -05:00
|
|
|
}
|
2015-10-02 04:47:03 -05:00
|
|
|
|
|
|
|
fn indices() {
|
2017-01-10 17:06:23 -06:00
|
|
|
let x = (aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc)
|
2017-02-20 21:59:14 -06:00
|
|
|
[x + y + z];
|
2017-01-10 17:06:23 -06:00
|
|
|
let y = (aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc)
|
2017-02-20 21:59:14 -06:00
|
|
|
[xxxxx + yyyyy + zzzzz];
|
2017-07-10 00:23:29 -05:00
|
|
|
let z = xxxxxxxxxx
|
|
|
|
.x()
|
|
|
|
.y()
|
|
|
|
.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz()[aaaaa];
|
|
|
|
let z = xxxxxxxxxx
|
|
|
|
.x()
|
|
|
|
.y()
|
|
|
|
.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz()
|
|
|
|
[aaaaa];
|
2015-10-02 04:47:03 -05:00
|
|
|
}
|
2015-10-02 05:00:28 -05:00
|
|
|
|
|
|
|
fn repeats() {
|
2017-01-10 17:06:23 -06:00
|
|
|
let x = [aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc;
|
2017-06-11 23:01:41 -05:00
|
|
|
x + y + z];
|
2017-01-10 17:06:23 -06:00
|
|
|
let y = [aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc;
|
2017-06-11 23:01:41 -05:00
|
|
|
xxxxx + yyyyy + zzzzz];
|
2015-10-02 05:00:28 -05:00
|
|
|
}
|
2015-10-14 15:28:17 -05:00
|
|
|
|
|
|
|
fn blocks() {
|
|
|
|
if 1 + 1 == 2 {
|
|
|
|
println!("yay arithmetix!");
|
2015-11-08 18:23:19 -06:00
|
|
|
};
|
2015-10-14 15:28:17 -05:00
|
|
|
}
|
2016-01-12 14:13:59 -06:00
|
|
|
|
|
|
|
fn issue767() {
|
|
|
|
if false {
|
|
|
|
if false {
|
|
|
|
} else {
|
|
|
|
// A let binding here seems necessary to trigger it.
|
|
|
|
let _ = ();
|
|
|
|
}
|
|
|
|
} else if let false = false {
|
|
|
|
}
|
|
|
|
}
|
2016-03-29 16:46:55 -05:00
|
|
|
|
|
|
|
fn ranges() {
|
|
|
|
let x = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
|
2017-07-05 04:31:37 -05:00
|
|
|
let y =
|
2017-09-27 15:36:46 -05:00
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
|
|
|
|
let z = ..=x;
|
2016-03-29 16:46:55 -05:00
|
|
|
|
2017-07-04 06:21:49 -05:00
|
|
|
// #1766
|
|
|
|
let x = [0. ..10.0];
|
2017-09-27 15:36:46 -05:00
|
|
|
let x = [0. ..=10.0];
|
2017-07-04 06:21:49 -05:00
|
|
|
|
2017-09-27 15:36:46 -05:00
|
|
|
a..=b
|
2016-03-29 16:46:55 -05:00
|
|
|
|
2017-09-27 15:36:46 -05:00
|
|
|
// the expr below won't compile because inclusive ranges need a defined end
|
|
|
|
// let a = 0 ..= ;
|
2016-03-29 16:46:55 -05:00
|
|
|
}
|
2016-05-29 10:58:38 -05:00
|
|
|
|
|
|
|
fn if_else() {
|
|
|
|
let exact = diff / (if size == 0 { 1 } else { size });
|
|
|
|
|
|
|
|
let cx = tp1.x + any * radius * if anticlockwise { 1.0 } else { -1.0 };
|
|
|
|
}
|
2016-06-03 16:18:19 -05:00
|
|
|
|
|
|
|
fn complex_if_else() {
|
|
|
|
if let Some(x) = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {
|
|
|
|
} else if let Some(x) = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {
|
|
|
|
ha();
|
|
|
|
} else if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxx {
|
|
|
|
yo();
|
2017-07-26 02:30:58 -05:00
|
|
|
} else if let Some(x) = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
2017-06-11 23:01:41 -05:00
|
|
|
{
|
2016-06-03 16:18:19 -05:00
|
|
|
ha();
|
2017-07-26 02:30:58 -05:00
|
|
|
} else if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxx
|
2017-06-11 23:01:41 -05:00
|
|
|
{
|
2016-06-03 16:18:19 -05:00
|
|
|
yo();
|
|
|
|
}
|
|
|
|
}
|
2016-09-09 09:20:16 -05:00
|
|
|
|
|
|
|
fn issue1106() {
|
|
|
|
{
|
|
|
|
if let hir::ItemEnum(ref enum_def, ref generics) =
|
2017-06-11 23:01:41 -05:00
|
|
|
self.ast_map.expect_item(enum_node_id).node
|
|
|
|
{}
|
2016-09-09 09:20:16 -05:00
|
|
|
}
|
|
|
|
|
2017-06-15 18:49:49 -05:00
|
|
|
for entry in WalkDir::new(path)
|
|
|
|
.into_iter()
|
|
|
|
.filter_entry(|entry| exclusions.filter_entry(entry))
|
2017-06-11 23:01:41 -05:00
|
|
|
{}
|
2016-09-09 09:20:16 -05:00
|
|
|
}
|
2017-06-20 07:36:28 -05:00
|
|
|
|
|
|
|
fn issue1570() {
|
|
|
|
a_very_long_function_name({ some_func(1, { 1 }) })
|
|
|
|
}
|
|
|
|
|
|
|
|
fn issue1714() {
|
|
|
|
v = &mut { v }[mid..];
|
|
|
|
let (left, right) = { v }.split_at_mut(mid);
|
|
|
|
}
|
2017-06-25 17:57:06 -05:00
|
|
|
|
|
|
|
// Multi-lined index should be put on the next line if it fits in one line.
|
|
|
|
fn issue1749() {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if self.shape[(r as f32 + self.x_offset) as usize]
|
2018-07-05 18:58:22 -05:00
|
|
|
[(c as f32 + self.y_offset) as usize]
|
|
|
|
!= 0
|
2017-06-25 17:57:06 -05:00
|
|
|
{
|
|
|
|
// hello
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-26 08:43:50 -05:00
|
|
|
|
|
|
|
// #1172
|
|
|
|
fn newlines_between_list_like_expr() {
|
|
|
|
foo(
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
|
|
|
|
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
|
|
|
|
);
|
|
|
|
|
|
|
|
vec![
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
|
|
|
|
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
|
|
|
|
];
|
|
|
|
|
|
|
|
match x {
|
2017-11-16 01:42:11 -06:00
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
| yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
|
|
|
| zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz => foo(a, b, c),
|
2017-07-26 08:43:50 -05:00
|
|
|
_ => bar(),
|
|
|
|
};
|
|
|
|
}
|
2017-11-30 00:00:13 -06:00
|
|
|
|
|
|
|
fn issue2178() {
|
|
|
|
Ok(result
|
|
|
|
.iter()
|
|
|
|
.map(|item| ls_util::rls_to_location(item))
|
|
|
|
.collect())
|
|
|
|
}
|
2018-03-05 08:38:16 -06:00
|
|
|
|
|
|
|
// #2493
|
|
|
|
impl Foo {
|
|
|
|
fn bar(&self) {
|
|
|
|
{
|
|
|
|
let x = match () {
|
|
|
|
() => {
|
|
|
|
let i;
|
2018-05-07 16:23:14 -05:00
|
|
|
i == self
|
|
|
|
.install_config
|
2018-03-05 08:38:16 -06:00
|
|
|
.storage
|
|
|
|
.experimental_compressed_block_size as usize
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-16 03:11:50 -05:00
|
|
|
|
|
|
|
fn dots() {
|
|
|
|
.. .. ..; // (.. (.. (..)))
|
|
|
|
..= ..= ..;
|
|
|
|
(..).. ..; // ((..) .. (..))
|
|
|
|
}
|
2018-05-05 22:12:16 -05:00
|
|
|
|
|
|
|
// #2676
|
|
|
|
// A function call with a large single argument.
|
|
|
|
fn foo() {
|
|
|
|
let my_var = Mutex::new(
|
2018-05-22 17:22:30 -05:00
|
|
|
RpcClientType::connect(server_iddd).chain_err(|| "Unable to create RPC client")?,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// #2704
|
|
|
|
// Method call with prefix and suffix.
|
|
|
|
fn issue2704() {
|
|
|
|
// We should not combine the callee with a multi-lined method call.
|
|
|
|
let requires = requires.set(
|
|
|
|
&requires0
|
|
|
|
.concat(&requires1)
|
|
|
|
.concat(&requires2)
|
|
|
|
.distinct_total(),
|
|
|
|
);
|
|
|
|
let requires = requires.set(
|
|
|
|
box requires0
|
|
|
|
.concat(&requires1)
|
|
|
|
.concat(&requires2)
|
|
|
|
.distinct_total(),
|
|
|
|
);
|
|
|
|
let requires = requires.set(
|
|
|
|
requires0
|
|
|
|
.concat(&requires1)
|
|
|
|
.concat(&requires2)
|
|
|
|
.distinct_total() as u32,
|
|
|
|
);
|
|
|
|
let requires = requires.set(
|
|
|
|
requires0
|
|
|
|
.concat(&requires1)
|
|
|
|
.concat(&requires2)
|
|
|
|
.distinct_total()?,
|
|
|
|
);
|
|
|
|
let requires = requires.set(
|
|
|
|
!requires0
|
|
|
|
.concat(&requires1)
|
|
|
|
.concat(&requires2)
|
|
|
|
.distinct_total(),
|
|
|
|
);
|
|
|
|
// We should combine a small callee with an argument.
|
|
|
|
bar(vec![22]
|
|
|
|
.into_iter()
|
|
|
|
.map(|x| x * 2)
|
|
|
|
.filter(|_| true)
|
|
|
|
.collect());
|
|
|
|
// But we should not combine a long callee with an argument.
|
|
|
|
barrrr(
|
|
|
|
vec![22]
|
|
|
|
.into_iter()
|
|
|
|
.map(|x| x * 2)
|
|
|
|
.filter(|_| true)
|
|
|
|
.collect(),
|
2018-05-05 22:12:16 -05:00
|
|
|
);
|
|
|
|
}
|
2018-06-30 20:40:47 -05:00
|
|
|
|
|
|
|
// #2782
|
|
|
|
fn issue2782() {
|
|
|
|
{
|
|
|
|
let f = {
|
|
|
|
let f = {
|
|
|
|
{
|
|
|
|
match f {
|
|
|
|
F(f, _) => loop {
|
|
|
|
let f = {
|
|
|
|
match f {
|
|
|
|
F(f, _) => match f {
|
|
|
|
F(f, _) => loop {
|
|
|
|
let f = {
|
|
|
|
let f = {
|
|
|
|
match f {
|
|
|
|
'-' => F(f, ()),
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2018-07-05 19:04:14 -05:00
|
|
|
|
|
|
|
fn issue_2802() {
|
|
|
|
function_to_fill_this_line(some_arg, some_arg, some_arg)
|
|
|
|
* a_very_specific_length(specific_length_arg)
|
|
|
|
* very_specific_length(Foo {
|
|
|
|
a: some_much_much_longer_value,
|
2018-07-12 05:21:07 -05:00
|
|
|
})
|
|
|
|
* some_value
|
2018-07-05 19:04:14 -05:00
|
|
|
}
|
2018-09-30 09:27:03 -05:00
|
|
|
|
|
|
|
fn issue_3003() {
|
|
|
|
let mut path: PathBuf = [
|
|
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
|
|
"tests",
|
|
|
|
"support",
|
|
|
|
"dejavu-fonts-ttf-2.37",
|
|
|
|
"ttf",
|
|
|
|
]
|
|
|
|
.iter()
|
|
|
|
.collect();
|
|
|
|
}
|
2018-12-25 03:20:29 -06:00
|
|
|
|
|
|
|
fn issue3226() {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Err(
|
|
|
|
ErrorKind::ManagementInterfaceError("Server exited unexpectedly").into(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
break Err(
|
|
|
|
ErrorKind::ManagementInterfaceError("Server exited unexpectedlyy").into(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-18 20:50:44 -05:00
|
|
|
|
|
|
|
// #3457
|
|
|
|
fn issue3457() {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
println!("Test");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-14 06:44:52 -05:00
|
|
|
|
|
|
|
// #3498
|
|
|
|
static REPRO: &[usize] = &[
|
|
|
|
#[cfg(feature = "zero")]
|
|
|
|
0,
|
|
|
|
];
|
|
|
|
|
|
|
|
fn overflow_with_attr() {
|
|
|
|
foo(
|
|
|
|
#[cfg(feature = "zero")]
|
|
|
|
0,
|
|
|
|
);
|
|
|
|
foobar(
|
|
|
|
#[cfg(feature = "zero")]
|
|
|
|
0,
|
|
|
|
);
|
|
|
|
foobar(
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
#[cfg(feature = "zero")]
|
|
|
|
{},
|
|
|
|
);
|
|
|
|
}
|