Skip to content

Commit 49b0c3f

Browse files
Improve wording for suggestion messages
1 parent 70573af commit 49b0c3f

10 files changed

+12
-12
lines changed

clippy_lints/src/loops/same_item_push.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(super) fn check<'tcx>(
3131
vec.span,
3232
"it looks like the same item is being pushed into this Vec",
3333
None,
34-
&format!("try using vec![{item_str};SIZE] or {vec_str}.resize(NEW_SIZE, {item_str})"),
34+
&format!("consider using vec![{item_str};SIZE] or {vec_str}.resize(NEW_SIZE, {item_str})"),
3535
);
3636
}
3737

clippy_lints/src/methods/join_absolute_paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, recv: &'tcx Expr<'tcx>, join_a
4242
)
4343
.span_suggestion(
4444
expr_span,
45-
"if this is intentional, try using `Path::new` instead",
45+
"if this is intentional, consider using `Path::new`",
4646
format!("PathBuf::from({arg_str})"),
4747
Applicability::Unspecified,
4848
);

clippy_lints/src/methods/manual_saturating_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn check(
5050
super::MANUAL_SATURATING_ARITHMETIC,
5151
expr.span,
5252
"manual saturating arithmetic",
53-
&format!("try using `saturating_{arith}`"),
53+
&format!("consider using `saturating_{arith}`"),
5454
format!(
5555
"{}.saturating_{arith}({})",
5656
snippet_with_applicability(cx, arith_lhs.span, "..", &mut applicability),

clippy_lints/src/methods/option_as_ref_deref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub(super) fn check(
9797
};
9898
let method_hint = if is_mut { "as_deref_mut" } else { "as_deref" };
9999
let hint = format!("{}.{method_hint}()", snippet(cx, as_ref_recv.span, ".."));
100-
let suggestion = format!("try using {method_hint} instead");
100+
let suggestion = format!("consider using {method_hint}");
101101

102102
let msg = format!("called `{current_method}` on an `Option` value");
103103
span_lint_and_sugg(

clippy_lints/src/methods/option_map_or_err_ok.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(super) fn check<'tcx>(
3333
OPTION_MAP_OR_ERR_OK,
3434
expr.span,
3535
msg,
36-
"try using `ok_or` instead",
36+
"consider using `ok_or`",
3737
format!("{self_snippet}.ok_or({err_snippet})"),
3838
Applicability::MachineApplicable,
3939
);

clippy_lints/src/methods/option_map_or_none.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub(super) fn check<'tcx>(
7272
OPTION_MAP_OR_NONE,
7373
expr.span,
7474
msg,
75-
"try using `map` instead",
75+
"consider using `map`",
7676
format!("{self_snippet}.map({arg_snippet} {func_snippet})"),
7777
Applicability::MachineApplicable,
7878
);
@@ -85,7 +85,7 @@ pub(super) fn check<'tcx>(
8585
OPTION_MAP_OR_NONE,
8686
expr.span,
8787
msg,
88-
"try using `and_then` instead",
88+
"consider using `and_then`",
8989
format!("{self_snippet}.and_then({func_snippet})"),
9090
Applicability::MachineApplicable,
9191
);
@@ -97,7 +97,7 @@ pub(super) fn check<'tcx>(
9797
RESULT_MAP_OR_INTO_OPTION,
9898
expr.span,
9999
msg,
100-
"try using `ok` instead",
100+
"consider using `ok`",
101101
format!("{self_snippet}.ok()"),
102102
Applicability::MachineApplicable,
103103
);

clippy_lints/src/methods/result_map_or_else_none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub(super) fn check<'tcx>(
3434
RESULT_MAP_OR_INTO_OPTION,
3535
expr.span,
3636
msg,
37-
"try using `ok` instead",
37+
"consider using `ok`",
3838
format!("{self_snippet}.ok()"),
3939
Applicability::MachineApplicable,
4040
);

clippy_lints/src/methods/single_char_pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(super) fn check(
5757
SINGLE_CHAR_PATTERN,
5858
arg.span,
5959
"single-character string constant used as pattern",
60-
"try using a `char` instead",
60+
"consider using a `char`",
6161
hint,
6262
applicability,
6363
);

clippy_lints/src/methods/unnecessary_join.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(super) fn check<'tcx>(
3232
UNNECESSARY_JOIN,
3333
span.with_hi(expr.span.hi()),
3434
r#"called `.collect::<Vec<String>>().join("")` on an iterator"#,
35-
"try using",
35+
"consider using",
3636
"collect::<String>()".to_owned(),
3737
applicability,
3838
);

clippy_lints/src/utils/internal_lints/almost_standard_lint_formulation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> LateLintPass<'tcx> for AlmostStandardFormulation {
6666
ident.span,
6767
"non-standard lint formulation",
6868
None,
69-
&format!("try using `{}` instead", formulation.correction),
69+
&format!("consider using `{}`", formulation.correction),
7070
);
7171
}
7272
return;

0 commit comments

Comments
 (0)