Skip to content

Commit d501c3b

Browse files
committed
fix warning message
1 parent d4c2a9d commit d501c3b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

clippy_lints/src/unnecessary_map_on_constructor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMapOnConstructor {
8888
cx,
8989
UNNECESSARY_MAP_ON_CONSTRUCTOR,
9090
expr.span,
91-
&format!("unnecessary {fun_snippet} on contstuctor {constructor_snippet}(_)"),
91+
&format!("unnecessary {} on constructor {constructor_snippet}(_)", path.ident.name),
9292
"try",
9393
format!("{constructor_snippet}({fun_snippet}({constructor_arg_snippet}))"),
9494
applicability,

tests/ui/unnecessary_map_on_constructor.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
error: unnecessary fun on contstuctor Some(_)
1+
error: unnecessary map on constructor Some(_)
22
--> $DIR/unnecessary_map_on_constructor.rs:32:13
33
|
44
LL | let a = Some(x).map(fun);
55
| ^^^^^^^^^^^^^^^^ help: try: `Some(fun(x))`
66
|
77
= note: `-D clippy::unnecessary-map-on-constructor` implied by `-D warnings`
88

9-
error: unnecessary fun on contstuctor Ok(_)
9+
error: unnecessary map on constructor Ok(_)
1010
--> $DIR/unnecessary_map_on_constructor.rs:33:27
1111
|
1212
LL | let b: SimpleResult = Ok(x).map(fun);
1313
| ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))`
1414

15-
error: unnecessary notfun on contstuctor Err(_)
15+
error: unnecessary map_err on constructor Err(_)
1616
--> $DIR/unnecessary_map_on_constructor.rs:34:27
1717
|
1818
LL | let c: SimpleResult = Err(err).map_err(notfun);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Err(notfun(err))`
2020

21-
error: unnecessary fun on contstuctor Option::Some(_)
21+
error: unnecessary map on constructor Option::Some(_)
2222
--> $DIR/unnecessary_map_on_constructor.rs:36:13
2323
|
2424
LL | let a = Option::Some(x).map(fun);
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Option::Some(fun(x))`
2626

27-
error: unnecessary fun on contstuctor SimpleResult::Ok(_)
27+
error: unnecessary map on constructor SimpleResult::Ok(_)
2828
--> $DIR/unnecessary_map_on_constructor.rs:37:27
2929
|
3030
LL | let b: SimpleResult = SimpleResult::Ok(x).map(fun);
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Ok(fun(x))`
3232

33-
error: unnecessary notfun on contstuctor SimpleResult::Err(_)
33+
error: unnecessary map_err on constructor SimpleResult::Err(_)
3434
--> $DIR/unnecessary_map_on_constructor.rs:38:27
3535
|
3636
LL | let c: SimpleResult = SimpleResult::Err(err).map_err(notfun);
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `SimpleResult::Err(notfun(err))`
3838

39-
error: unnecessary fun on contstuctor Ok(_)
39+
error: unnecessary map on constructor Ok(_)
4040
--> $DIR/unnecessary_map_on_constructor.rs:39:52
4141
|
4242
LL | let b: std::result::Result<i32, SimpleError> = Ok(x).map(fun);
4343
| ^^^^^^^^^^^^^^ help: try: `Ok(fun(x))`
4444

45-
error: unnecessary notfun on contstuctor Err(_)
45+
error: unnecessary map_err on constructor Err(_)
4646
--> $DIR/unnecessary_map_on_constructor.rs:40:52
4747
|
4848
LL | let c: std::result::Result<i32, SimpleError> = Err(err).map_err(notfun);

0 commit comments

Comments
 (0)