rust-clippy/tests/ui/or_fun_call.stderr

173 lines
6.4 KiB
Text
Raw Normal View History

error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:54:22
|
LL | with_constructor.unwrap_or(make());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(make)`
|
= note: `-D clippy::or-fun-call` implied by `-D warnings`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:57:14
|
LL | with_new.unwrap_or(Vec::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:60:21
|
LL | with_const_args.unwrap_or(Vec::with_capacity(12));
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Vec::with_capacity(12))`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:63:14
|
LL | with_err.unwrap_or(make());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:66:19
|
LL | with_err_args.unwrap_or(Vec::with_capacity(12));
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))`
error: use of `unwrap_or` followed by a call to `default`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:69:24
|
LL | with_default_trait.unwrap_or(Default::default());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `default`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:72:23
|
LL | with_default_type.unwrap_or(u64::default());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:75:18
|
LL | self_default.unwrap_or(<FakeDefault>::default());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(<FakeDefault>::default)`
error: use of `unwrap_or` followed by a call to `default`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:78:18
|
LL | real_default.unwrap_or(<FakeDefault as Default>::default());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
2020-04-01 18:14:05 +00:00
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:81:14
|
LL | with_vec.unwrap_or(vec![]);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:84:21
|
LL | without_default.unwrap_or(Foo::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)`
error: use of `or_insert` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:87:19
|
LL | map.entry(42).or_insert(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
error: use of `or_insert` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:90:23
|
LL | map_vec.entry(42).or_insert(vec![]);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^ help: try: `or_default()`
error: use of `or_insert` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:93:21
|
LL | btree.entry(42).or_insert(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
error: use of `or_insert` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:96:25
|
LL | btree_vec.entry(42).or_insert(vec![]);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^ help: try: `or_default()`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:99:21
|
LL | let _ = stringy.unwrap_or(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:107:21
|
LL | let _ = Some(1).unwrap_or(map[&1]);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:109:21
|
LL | let _ = Some(1).unwrap_or(map[&1]);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`
2019-05-12 08:18:38 +00:00
error: use of `or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:133:35
2019-05-12 08:18:38 +00:00
|
LL | let _ = Some("a".to_string()).or(Some("b".to_string()));
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))`
2019-05-12 08:18:38 +00:00
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:172:14
|
LL | None.unwrap_or(ptr_to_ref(s));
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:178:14
|
LL | None.unwrap_or(unsafe { ptr_to_ref(s) });
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
error: use of `unwrap_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:180:14
|
LL | None.unwrap_or( unsafe { ptr_to_ref(s) } );
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:194:14
|
2022-07-10 10:11:19 +00:00
LL | .unwrap_or(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:207:14
|
2022-07-10 10:11:19 +00:00
LL | .unwrap_or(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:219:14
|
2022-07-10 10:11:19 +00:00
LL | .unwrap_or(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `unwrap_or` followed by a call to `new`
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:230:10
|
2022-07-10 10:11:19 +00:00
LL | .unwrap_or(String::new());
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
error: use of `map_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:255:25
|
LL | let _ = Some(4).map_or(g(), |v| v);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)`
error: use of `map_or` followed by a function call
2023-05-31 17:47:10 +00:00
--> $DIR/or_fun_call.rs:256:25
|
LL | let _ = Some(4).map_or(g(), f);
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)`
error: aborting due to 28 previous errors