| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:54:22 |
| | |
| LL | with_constructor.unwrap_or(make()); |
| | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(make)` |
| | |
| = note: `-D clippy::or-fun-call` implied by `-D warnings` |
| = help: to override `-D warnings` add `#[allow(clippy::or_fun_call)]` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:58:14 |
| | |
| LL | with_new.unwrap_or(Vec::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| | |
| = note: `-D clippy::unwrap-or-default` implied by `-D warnings` |
| = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:62:21 |
| | |
| LL | with_const_args.unwrap_or(Vec::with_capacity(12)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:66:14 |
| | |
| LL | with_err.unwrap_or(make()); |
| | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:70:19 |
| | |
| LL | with_err_args.unwrap_or(Vec::with_capacity(12)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:74:24 |
| | |
| LL | with_default_trait.unwrap_or(Default::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:78:23 |
| | |
| LL | with_default_type.unwrap_or(u64::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:98:18 |
| | |
| LL | self_default.unwrap_or(<FakeDefault>::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(<FakeDefault>::default)` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:102:18 |
| | |
| LL | real_default.unwrap_or(<FakeDefault as Default>::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:106:14 |
| | |
| LL | with_vec.unwrap_or(Vec::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:110:21 |
| | |
| LL | without_default.unwrap_or(Foo::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)` |
| |
| error: use of `or_insert` to construct default value |
| --> tests/ui/or_fun_call.rs:114:19 |
| | |
| LL | map.entry(42).or_insert(String::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `or_insert` to construct default value |
| --> tests/ui/or_fun_call.rs:118:23 |
| | |
| LL | map_vec.entry(42).or_insert(Vec::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `or_insert` to construct default value |
| --> tests/ui/or_fun_call.rs:122:21 |
| | |
| LL | btree.entry(42).or_insert(String::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `or_insert` to construct default value |
| --> tests/ui/or_fun_call.rs:126:25 |
| | |
| LL | btree_vec.entry(42).or_insert(Vec::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:130:21 |
| | |
| LL | let _ = stringy.unwrap_or(String::new()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `ok_or` |
| --> tests/ui/or_fun_call.rs:135:17 |
| | |
| LL | let _ = opt.ok_or(format!("{} world.", hello)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:140:21 |
| | |
| LL | let _ = Some(1).unwrap_or(map[&1]); |
| | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:143:21 |
| | |
| LL | let _ = Some(1).unwrap_or(map[&1]); |
| | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])` |
| |
| error: function call inside of `or` |
| --> tests/ui/or_fun_call.rs:168:35 |
| | |
| LL | let _ = Some("a".to_string()).or(Some("b".to_string())); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:211:18 |
| | |
| LL | None.unwrap_or(ptr_to_ref(s)); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:219:14 |
| | |
| LL | None.unwrap_or(unsafe { ptr_to_ref(s) }); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:222:14 |
| | |
| LL | None.unwrap_or( unsafe { ptr_to_ref(s) } ); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:298:25 |
| | |
| LL | let _ = Some(4).map_or(g(), |v| v); |
| | ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:300:25 |
| | |
| LL | let _ = Some(4).map_or(g(), f); |
| | ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:303:25 |
| | |
| LL | let _ = Some(4).map_or("asd".to_string().len() as i32, f); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| "asd".to_string().len() as i32, f)` |
| |
| error: use of `unwrap_or_else` to construct default value |
| --> tests/ui/or_fun_call.rs:334:18 |
| | |
| LL | with_new.unwrap_or_else(Vec::new); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or_else` to construct default value |
| --> tests/ui/or_fun_call.rs:338:28 |
| | |
| LL | with_default_trait.unwrap_or_else(Default::default); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or_else` to construct default value |
| --> tests/ui/or_fun_call.rs:342:27 |
| | |
| LL | with_default_type.unwrap_or_else(u64::default); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or_else` to construct default value |
| --> tests/ui/or_fun_call.rs:346:22 |
| | |
| LL | real_default.unwrap_or_else(<FakeDefault as Default>::default); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `or_insert_with` to construct default value |
| --> tests/ui/or_fun_call.rs:350:23 |
| | |
| LL | map.entry(42).or_insert_with(String::new); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `or_insert_with` to construct default value |
| --> tests/ui/or_fun_call.rs:354:25 |
| | |
| LL | btree.entry(42).or_insert_with(String::new); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` |
| |
| error: use of `unwrap_or_else` to construct default value |
| --> tests/ui/or_fun_call.rs:358:25 |
| | |
| LL | let _ = stringy.unwrap_or_else(String::new); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:400:17 |
| | |
| LL | let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)` |
| | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:405:17 |
| | |
| LL | let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)` |
| | ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:410:17 |
| | |
| LL | let _ = opt.unwrap_or({ |
| | _________________^ |
| LL | | |
| LL | | let x = f(); |
| LL | | x + 1 |
| LL | | }); |
| | |______^ |
| | |
| help: try |
| | |
| LL ~ let _ = opt.unwrap_or_else(|| { |
| LL + |
| LL + let x = f(); |
| LL + x + 1 |
| LL ~ }); |
| | |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:416:17 |
| | |
| LL | let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)` |
| | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| f() + 1, |v| v)` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:421:17 |
| | |
| LL | let _ = opt.unwrap_or({ i32::default() }); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:428:21 |
| | |
| LL | let _ = opt_foo.unwrap_or(Foo { val: String::default() }); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:443:19 |
| | |
| LL | let _ = x.map_or(g(), |v| v); |
| | ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), |v| v)` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:445:19 |
| | |
| LL | let _ = x.map_or(g(), f); |
| | ^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), f)` |
| |
| error: function call inside of `map_or` |
| --> tests/ui/or_fun_call.rs:448:19 |
| | |
| LL | let _ = x.map_or("asd".to_string().len() as i32, f); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| "asd".to_string().len() as i32, f)` |
| |
| error: function call inside of `get_or_insert` |
| --> tests/ui/or_fun_call.rs:459:15 |
| | |
| LL | let _ = x.get_or_insert(g()); |
| | ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)` |
| |
| error: function call inside of `and` |
| --> tests/ui/or_fun_call.rs:469:15 |
| | |
| LL | let _ = x.and(g()); |
| | ^^^^^^^^ help: try: `and_then(|_| g())` |
| |
| error: function call inside of `and` |
| --> tests/ui/or_fun_call.rs:479:15 |
| | |
| LL | let _ = x.and(g()); |
| | ^^^^^^^^ help: try: `and_then(|_| g())` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:485:17 |
| | |
| LL | let _ = opt.unwrap_or(Default::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: function call inside of `unwrap_or` |
| --> tests/ui/or_fun_call.rs:487:17 |
| | |
| LL | let _ = res.unwrap_or(Default::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Default::default())` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:493:17 |
| | |
| LL | let _ = opt.unwrap_or(Default::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: use of `unwrap_or` to construct default value |
| --> tests/ui/or_fun_call.rs:495:17 |
| | |
| LL | let _ = res.unwrap_or(Default::default()); |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` |
| |
| error: aborting due to 49 previous errors |
| |