Skip to content

Commit 966dadc

Browse files
committed
Run rustfmt
1 parent 895a0f9 commit 966dadc

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

clippy_lints/src/methods/unnecessary_fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir as hir;
88
use rustc_hir::PatKind;
99
use rustc_lint::LateContext;
1010
use rustc_middle::ty;
11-
use rustc_span::{Span, sym, Symbol};
11+
use rustc_span::{Span, Symbol, sym};
1212

1313
use super::UNNECESSARY_FOLD;
1414

tests/ui/unnecessary_fold.fixed

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ fn unnecessary_fold_over_multiple_lines() {
5858
fn issue10000() {
5959
use std::collections::HashMap;
6060
use std::hash::BuildHasher;
61-
use std::ops::Add;
62-
use std::ops::Mul;
61+
use std::ops::{Add, Mul};
6362

6463
fn anything<T>(_: T) {}
6564
fn num(_: i32) {}

tests/ui/unnecessary_fold.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ fn unnecessary_fold_over_multiple_lines() {
5858
fn issue10000() {
5959
use std::collections::HashMap;
6060
use std::hash::BuildHasher;
61-
use std::ops::Add;
62-
use std::ops::Mul;
61+
use std::ops::{Add, Mul};
6362

6463
fn anything<T>(_: T) {}
6564
fn num(_: i32) {}

tests/ui/unnecessary_fold.stderr

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,115 +59,115 @@ LL | .fold(false, |acc, x| acc || x > 2);
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `any(|x| x > 2)`
6060

6161
error: this `.fold` can be written more succinctly using another method
62-
--> tests/ui/unnecessary_fold.rs:68:33
62+
--> tests/ui/unnecessary_fold.rs:67:33
6363
|
6464
LL | assert_eq!(map.values().fold(0, |x, y| x + y), 0);
6565
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
6666

6767
error: this `.fold` can be written more succinctly using another method
68-
--> tests/ui/unnecessary_fold.rs:71:30
68+
--> tests/ui/unnecessary_fold.rs:70:30
6969
|
7070
LL | let _ = map.values().fold(0, |x, y| x + y);
7171
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
7272

7373
error: this `.fold` can be written more succinctly using another method
74-
--> tests/ui/unnecessary_fold.rs:72:30
74+
--> tests/ui/unnecessary_fold.rs:71:30
7575
|
7676
LL | let _ = map.values().fold(0, Add::add);
7777
| ^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
7878

7979
error: this `.fold` can be written more succinctly using another method
80-
--> tests/ui/unnecessary_fold.rs:73:30
80+
--> tests/ui/unnecessary_fold.rs:72:30
8181
|
8282
LL | let _ = map.values().fold(1, |x, y| x * y);
8383
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
8484

8585
error: this `.fold` can be written more succinctly using another method
86-
--> tests/ui/unnecessary_fold.rs:74:30
86+
--> tests/ui/unnecessary_fold.rs:73:30
8787
|
8888
LL | let _ = map.values().fold(1, Mul::mul);
8989
| ^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
9090

9191
error: this `.fold` can be written more succinctly using another method
92-
--> tests/ui/unnecessary_fold.rs:75:35
92+
--> tests/ui/unnecessary_fold.rs:74:35
9393
|
9494
LL | let _: i32 = map.values().fold(0, |x, y| x + y);
9595
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
9696

9797
error: this `.fold` can be written more succinctly using another method
98-
--> tests/ui/unnecessary_fold.rs:76:35
98+
--> tests/ui/unnecessary_fold.rs:75:35
9999
|
100100
LL | let _: i32 = map.values().fold(0, Add::add);
101101
| ^^^^^^^^^^^^^^^^^ help: try: `sum()`
102102

103103
error: this `.fold` can be written more succinctly using another method
104-
--> tests/ui/unnecessary_fold.rs:77:35
104+
--> tests/ui/unnecessary_fold.rs:76:35
105105
|
106106
LL | let _: i32 = map.values().fold(1, |x, y| x * y);
107107
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
108108

109109
error: this `.fold` can be written more succinctly using another method
110-
--> tests/ui/unnecessary_fold.rs:78:35
110+
--> tests/ui/unnecessary_fold.rs:77:35
111111
|
112112
LL | let _: i32 = map.values().fold(1, Mul::mul);
113113
| ^^^^^^^^^^^^^^^^^ help: try: `product()`
114114

115115
error: this `.fold` can be written more succinctly using another method
116-
--> tests/ui/unnecessary_fold.rs:79:31
116+
--> tests/ui/unnecessary_fold.rs:78:31
117117
|
118118
LL | anything(map.values().fold(0, |x, y| x + y));
119119
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
120120

121121
error: this `.fold` can be written more succinctly using another method
122-
--> tests/ui/unnecessary_fold.rs:80:31
122+
--> tests/ui/unnecessary_fold.rs:79:31
123123
|
124124
LL | anything(map.values().fold(0, Add::add));
125125
| ^^^^^^^^^^^^^^^^^ help: try: `sum::<i32>()`
126126

127127
error: this `.fold` can be written more succinctly using another method
128-
--> tests/ui/unnecessary_fold.rs:81:31
128+
--> tests/ui/unnecessary_fold.rs:80:31
129129
|
130130
LL | anything(map.values().fold(1, |x, y| x * y));
131131
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
132132

133133
error: this `.fold` can be written more succinctly using another method
134-
--> tests/ui/unnecessary_fold.rs:82:31
134+
--> tests/ui/unnecessary_fold.rs:81:31
135135
|
136136
LL | anything(map.values().fold(1, Mul::mul));
137137
| ^^^^^^^^^^^^^^^^^ help: try: `product::<i32>()`
138138

139139
error: this `.fold` can be written more succinctly using another method
140-
--> tests/ui/unnecessary_fold.rs:83:26
140+
--> tests/ui/unnecessary_fold.rs:82:26
141141
|
142142
LL | num(map.values().fold(0, |x, y| x + y));
143143
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
144144

145145
error: this `.fold` can be written more succinctly using another method
146-
--> tests/ui/unnecessary_fold.rs:84:26
146+
--> tests/ui/unnecessary_fold.rs:83:26
147147
|
148148
LL | num(map.values().fold(0, Add::add));
149149
| ^^^^^^^^^^^^^^^^^ help: try: `sum()`
150150

151151
error: this `.fold` can be written more succinctly using another method
152-
--> tests/ui/unnecessary_fold.rs:85:26
152+
--> tests/ui/unnecessary_fold.rs:84:26
153153
|
154154
LL | num(map.values().fold(1, |x, y| x * y));
155155
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `product()`
156156

157157
error: this `.fold` can be written more succinctly using another method
158-
--> tests/ui/unnecessary_fold.rs:86:26
158+
--> tests/ui/unnecessary_fold.rs:85:26
159159
|
160160
LL | num(map.values().fold(1, Mul::mul));
161161
| ^^^^^^^^^^^^^^^^^ help: try: `product()`
162162

163163
error: this `.fold` can be written more succinctly using another method
164-
--> tests/ui/unnecessary_fold.rs:92:16
164+
--> tests/ui/unnecessary_fold.rs:91:16
165165
|
166166
LL | (0..3).fold(0, |acc, x| acc + x)
167167
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`
168168

169169
error: this `.fold` can be written more succinctly using another method
170-
--> tests/ui/unnecessary_fold.rs:95:16
170+
--> tests/ui/unnecessary_fold.rs:94:16
171171
|
172172
LL | (0..3).fold(0, |acc, x| acc + x)
173173
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum()`

0 commit comments

Comments
 (0)