fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: redundant closure 2 --> $DIR/eta.rs:29:27 3 | 4LL | let a = Some(1u8).map(|a| foo(a)); 5 | ^^^^^^^^^^ help: replace the closure with the function itself: `foo` 6 | 7 = note: `-D clippy::redundant-closure` implied by `-D warnings` 8 = help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]` 9 10error: redundant closure 11 --> $DIR/eta.rs:33:40 12 | 13LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec! 14 | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new` 15 16error: redundant closure 17 --> $DIR/eta.rs:34:35 18 | 19LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted? 20 | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2` 21 22error: redundant closure 23 --> $DIR/eta.rs:35:26 24 | 25LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted 26 | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below` 27 28error: redundant closure 29 --> $DIR/eta.rs:42:27 30 | 31LL | let e = Some(1u8).map(|a| generic(a)); 32 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic` 33 34error: redundant closure 35 --> $DIR/eta.rs:94:51 36 | 37LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo()); 38 | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo` 39 | 40 = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings` 41 = help: to override `-D warnings` add `#[allow(clippy::redundant_closure_for_method_calls)]` 42 43error: redundant closure 44 --> $DIR/eta.rs:95:51 45 | 46LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo()); 47 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo` 48 49error: redundant closure 50 --> $DIR/eta.rs:97:42 51 | 52LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear()); 53 | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear` 54 55error: redundant closure 56 --> $DIR/eta.rs:101:29 57 | 58LL | let e = Some("str").map(|s| s.to_string()); 59 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string` 60 61error: redundant closure 62 --> $DIR/eta.rs:102:27 63 | 64LL | let e = Some('a').map(|s| s.to_uppercase()); 65 | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase` 66 67error: redundant closure 68 --> $DIR/eta.rs:104:65 69 | 70LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect(); 71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase` 72 73error: redundant closure 74 --> $DIR/eta.rs:167:22 75 | 76LL | requires_fn_once(|| x()); 77 | ^^^^^^ help: replace the closure with the function itself: `x` 78 79error: redundant closure 80 --> $DIR/eta.rs:174:27 81 | 82LL | let a = Some(1u8).map(|a| foo_ptr(a)); 83 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr` 84 85error: redundant closure 86 --> $DIR/eta.rs:179:27 87 | 88LL | let a = Some(1u8).map(|a| closure(a)); 89 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure` 90 91error: redundant closure 92 --> $DIR/eta.rs:211:28 93 | 94LL | x.into_iter().for_each(|x| add_to_res(x)); 95 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` 96 97error: redundant closure 98 --> $DIR/eta.rs:212:28 99 | 100LL | y.into_iter().for_each(|x| add_to_res(x)); 101 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` 102 103error: redundant closure 104 --> $DIR/eta.rs:213:28 105 | 106LL | z.into_iter().for_each(|x| add_to_res(x)); 107 | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res` 108 109error: redundant closure 110 --> $DIR/eta.rs:220:21 111 | 112LL | Some(1).map(|n| closure(n)); 113 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure` 114 115error: redundant closure 116 --> $DIR/eta.rs:224:21 117 | 118LL | Some(1).map(|n| in_loop(n)); 119 | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop` 120 121error: redundant closure 122 --> $DIR/eta.rs:317:18 123 | 124LL | takes_fn_mut(|| f()); 125 | ^^^^^^ help: replace the closure with the function itself: `&mut f` 126 127error: redundant closure 128 --> $DIR/eta.rs:320:19 129 | 130LL | takes_fn_once(|| f()); 131 | ^^^^^^ help: replace the closure with the function itself: `&mut f` 132 133error: redundant closure 134 --> $DIR/eta.rs:324:26 135 | 136LL | move || takes_fn_mut(|| f_used_once()) 137 | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once` 138 139error: redundant closure 140 --> $DIR/eta.rs:336:19 141 | 142LL | array_opt.map(|a| a.as_slice()); 143 | ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice` 144 145error: redundant closure 146 --> $DIR/eta.rs:339:19 147 | 148LL | slice_opt.map(|s| s.len()); 149 | ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len` 150 151error: redundant closure 152 --> $DIR/eta.rs:342:17 153 | 154LL | ptr_opt.map(|p| p.is_null()); 155 | ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null` 156 157error: redundant closure 158 --> $DIR/eta.rs:346:17 159 | 160LL | dyn_opt.map(|d| d.method_on_dyn()); 161 | ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn` 162 163error: redundant closure 164 --> $DIR/eta.rs:389:19 165 | 166LL | let _ = f(&0, |x, y| f2(x, y)); 167 | ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `f2` 168 169error: aborting due to 27 previous errors 170