]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_lint/src/builtin.rs
Rollup merge of #98043 - TaKO8Ki:remove-unnecessary-to-string, r=davidtwco
[rust.git] / compiler / rustc_lint / src / builtin.rs
index 29695caafb4c1b495e45990117c99b2b07897298..50017955ee19d55f4a53131c5058618a9014007a 100644 (file)
@@ -993,7 +993,7 @@ fn lint_deprecated_attr(
             .span_suggestion_short(
                 attr.span,
                 suggestion.unwrap_or("remove this attribute"),
-                String::new(),
+                "",
                 Applicability::MachineApplicable,
             )
             .emit();
@@ -1182,7 +1182,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
                                 .span_suggestion_short(
                                     no_mangle_attr.span,
                                     "remove this attribute",
-                                    String::new(),
+                                    "",
                                     // Use of `#[no_mangle]` suggests FFI intent; correct
                                     // fix may be to monomorphize source by hand
                                     Applicability::MaybeIncorrect,
@@ -1221,7 +1221,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
                         err.span_suggestion(
                             const_span,
                             "try a static value",
-                            "pub static".to_owned(),
+                            "pub static",
                             Applicability::MachineApplicable,
                         );
                         err.emit();
@@ -1405,7 +1405,7 @@ fn perform_lint(
                 err.span_suggestion(
                     vis_span,
                     "consider restricting its visibility",
-                    "pub(crate)".to_owned(),
+                    "pub(crate)",
                     applicability,
                 );
                 if exportable {
@@ -1566,7 +1566,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
                 err.span_suggestion(
                     type_alias_generics.where_clause_span,
                     "the clause will not be checked when the type alias is used, and should be removed",
-                    String::new(),
+                    "",
                     Applicability::MachineApplicable,
                 );
                 if !suggested_changing_assoc_types {
@@ -1830,7 +1830,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)>
                     });
                 }
             } else {
-                let replace = "..=".to_owned();
+                let replace = "..=";
                 if join.edition() >= Edition::Edition2021 {
                     let mut err =
                         rustc_errors::struct_span_err!(cx.sess(), pat.span, E0783, "{}", msg,);