diff options
| author | bors <bors@rust-lang.org> | 2022-10-23 09:06:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-23 09:06:39 +0000 |
| commit | e64f1110c062f61746f222059439529a43ccf6dc (patch) | |
| tree | f6deb949a3796b6fd79eef0a3745e2d9dcc1ae8c /compiler/rustc_lint/src | |
| parent | faab68eb29121f25b577b50e2e00e33bafc60a36 (diff) | |
| parent | 6987322445d7388b61d6249204402574ee0308f5 (diff) | |
| download | rust-e64f1110c062f61746f222059439529a43ccf6dc.tar.gz rust-e64f1110c062f61746f222059439529a43ccf6dc.zip | |
Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errors
Flatten diagnostic slug modules This makes it easier to grep for the slugs in the code. See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it. This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know. r? `@davidtwco`
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/array_into_iter.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 160 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/enum_intrinsics_non_enums.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/errors.rs | 34 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/expect.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/hidden_unicode_codepoints.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/internal.rs | 36 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/methods.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/non_ascii_idents.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/non_fmt_panic.rs | 65 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/nonstandard_style.rs | 26 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/noop_method_call.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/pass_by_value.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/redundant_semicolon.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/traits.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/types.rs | 124 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 36 |
18 files changed, 272 insertions, 291 deletions
diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs index bd6b637f76f..abebc533cc1 100644 --- a/compiler/rustc_lint/src/array_into_iter.rs +++ b/compiler/rustc_lint/src/array_into_iter.rs @@ -121,25 +121,25 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter { cx.struct_span_lint( ARRAY_INTO_ITER, call.ident.span, - fluent::lint::array_into_iter, + fluent::lint_array_into_iter, |diag| { diag.set_arg("target", target); diag.span_suggestion( call.ident.span, - fluent::lint::use_iter_suggestion, + fluent::use_iter_suggestion, "iter", Applicability::MachineApplicable, ); if self.for_expr_span == expr.span { diag.span_suggestion( receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()), - fluent::lint::remove_into_iter_suggestion, + fluent::remove_into_iter_suggestion, "", Applicability::MaybeIncorrect, ); } else if receiver_ty.is_array() { diag.multipart_suggestion( - fluent::lint::use_explicit_into_iter_suggestion, + fluent::use_explicit_into_iter_suggestion, vec![ (expr.span.shrink_to_lo(), "IntoIterator::into_iter(".into()), ( diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 8afc061176f..27f8cc0a655 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -106,11 +106,11 @@ impl EarlyLintPass for WhileTrue { cx.struct_span_lint( WHILE_TRUE, condition_span, - fluent::lint::builtin_while_true, + fluent::lint_builtin_while_true, |lint| { lint.span_suggestion_short( condition_span, - fluent::lint::suggestion, + fluent::suggestion, format!( "{}loop", label.map_or_else(String::new, |label| format!( @@ -160,7 +160,7 @@ impl BoxPointers { cx.struct_span_lint( BOX_POINTERS, span, - fluent::lint::builtin_box_pointers, + fluent::lint_builtin_box_pointers, |lint| lint.set_arg("ty", ty), ); } @@ -264,13 +264,13 @@ impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns { cx.struct_span_lint( NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span, - fluent::lint::builtin_non_shorthand_field_patterns, + fluent::lint_builtin_non_shorthand_field_patterns, |lint| { let suggested_ident = format!("{}{}", binding_annot.prefix_str(), ident); lint.set_arg("ident", ident.clone()).span_suggestion( fieldpat.span, - fluent::lint::suggestion, + fluent::suggestion, suggested_ident, Applicability::MachineApplicable, ) @@ -335,7 +335,7 @@ impl UnsafeCode { msg: DiagnosticMessage, ) { self.report_unsafe(cx, span, msg, |lint| { - lint.note(fluent::lint::builtin_overridden_symbol_name) + lint.note(fluent::lint_builtin_overridden_symbol_name) }) } @@ -346,7 +346,7 @@ impl UnsafeCode { msg: DiagnosticMessage, ) { self.report_unsafe(cx, span, msg, |lint| { - lint.note(fluent::lint::builtin_overridden_symbol_section) + lint.note(fluent::lint_builtin_overridden_symbol_section) }) } } @@ -354,12 +354,9 @@ impl UnsafeCode { impl EarlyLintPass for UnsafeCode { fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) { if attr.has_name(sym::allow_internal_unsafe) { - self.report_unsafe( - cx, - attr.span, - fluent::lint::builtin_allow_internal_unsafe, - |lint| lint, - ); + self.report_unsafe(cx, attr.span, fluent::lint_builtin_allow_internal_unsafe, |lint| { + lint + }); } } @@ -367,7 +364,7 @@ impl EarlyLintPass for UnsafeCode { if let ast::ExprKind::Block(ref blk, _) = e.kind { // Don't warn about generated blocks; that'll just pollute the output. if blk.rules == ast::BlockCheckMode::Unsafe(ast::UserProvided) { - self.report_unsafe(cx, blk.span, fluent::lint::builtin_unsafe_block, |lint| lint); + self.report_unsafe(cx, blk.span, fluent::lint_builtin_unsafe_block, |lint| lint); } } } @@ -375,11 +372,11 @@ impl EarlyLintPass for UnsafeCode { fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) { match it.kind { ast::ItemKind::Trait(box ast::Trait { unsafety: ast::Unsafe::Yes(_), .. }) => { - self.report_unsafe(cx, it.span, fluent::lint::builtin_unsafe_trait, |lint| lint) + self.report_unsafe(cx, it.span, fluent::lint_builtin_unsafe_trait, |lint| lint) } ast::ItemKind::Impl(box ast::Impl { unsafety: ast::Unsafe::Yes(_), .. }) => { - self.report_unsafe(cx, it.span, fluent::lint::builtin_unsafe_impl, |lint| lint) + self.report_unsafe(cx, it.span, fluent::lint_builtin_unsafe_impl, |lint| lint) } ast::ItemKind::Fn(..) => { @@ -387,7 +384,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_no_mangle_fn, + fluent::lint_builtin_no_mangle_fn, ); } @@ -395,7 +392,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_export_name_fn, + fluent::lint_builtin_export_name_fn, ); } @@ -403,7 +400,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_section( cx, attr.span, - fluent::lint::builtin_link_section_fn, + fluent::lint_builtin_link_section_fn, ); } } @@ -413,7 +410,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_no_mangle_static, + fluent::lint_builtin_no_mangle_static, ); } @@ -421,7 +418,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_export_name_static, + fluent::lint_builtin_export_name_static, ); } @@ -429,7 +426,7 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_section( cx, attr.span, - fluent::lint::builtin_link_section_static, + fluent::lint_builtin_link_section_static, ); } } @@ -444,14 +441,14 @@ impl EarlyLintPass for UnsafeCode { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_no_mangle_method, + fluent::lint_builtin_no_mangle_method, ); } if let Some(attr) = cx.sess().find_by_name(&it.attrs, sym::export_name) { self.report_overridden_symbol_name( cx, attr.span, - fluent::lint::builtin_export_name_method, + fluent::lint_builtin_export_name_method, ); } } @@ -469,9 +466,9 @@ impl EarlyLintPass for UnsafeCode { { let msg = match ctxt { FnCtxt::Foreign => return, - FnCtxt::Free => fluent::lint::builtin_decl_unsafe_fn, - FnCtxt::Assoc(_) if body.is_none() => fluent::lint::builtin_decl_unsafe_method, - FnCtxt::Assoc(_) => fluent::lint::builtin_impl_unsafe_method, + FnCtxt::Free => fluent::lint_builtin_decl_unsafe_fn, + FnCtxt::Assoc(_) if body.is_none() => fluent::lint_builtin_decl_unsafe_method, + FnCtxt::Assoc(_) => fluent::lint_builtin_impl_unsafe_method, }; self.report_unsafe(cx, span, msg, |lint| lint); } @@ -577,7 +574,7 @@ impl MissingDoc { cx.struct_span_lint( MISSING_DOCS, cx.tcx.def_span(def_id), - fluent::lint::builtin_missing_doc, + fluent::lint_builtin_missing_doc, |lint| lint.set_arg("article", article).set_arg("desc", desc), ); } @@ -769,7 +766,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations { cx.struct_span_lint( MISSING_COPY_IMPLEMENTATIONS, item.span, - fluent::lint::builtin_missing_copy_impl, + fluent::lint_builtin_missing_copy_impl, |lint| lint, ) } @@ -848,7 +845,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations { cx.struct_span_lint( MISSING_DEBUG_IMPLEMENTATIONS, item.span, - fluent::lint::builtin_missing_debug_impl, + fluent::lint_builtin_missing_debug_impl, |lint| lint.set_arg("debug", cx.tcx.def_path_str(debug)), ); } @@ -928,11 +925,11 @@ impl EarlyLintPass for AnonymousParameters { cx.struct_span_lint( ANONYMOUS_PARAMETERS, arg.pat.span, - fluent::lint::builtin_anonymous_params, + fluent::lint_builtin_anonymous_params, |lint| { lint.span_suggestion( arg.pat.span, - fluent::lint::suggestion, + fluent::suggestion, format!("_: {}", ty_snip), appl, ) @@ -976,7 +973,7 @@ impl EarlyLintPass for DeprecatedAttr { cx.struct_span_lint( DEPRECATED, attr.span, - fluent::lint::builtin_deprecated_attr_link, + fluent::lint_builtin_deprecated_attr_link, |lint| { lint.set_arg("name", name) .set_arg("reason", reason) @@ -984,7 +981,7 @@ impl EarlyLintPass for DeprecatedAttr { .span_suggestion_short( attr.span, suggestion.map(|s| s.into()).unwrap_or( - fluent::lint::builtin_deprecated_attr_default_suggestion, + fluent::lint_builtin_deprecated_attr_default_suggestion, ), "", Applicability::MachineApplicable, @@ -999,12 +996,12 @@ impl EarlyLintPass for DeprecatedAttr { cx.struct_span_lint( DEPRECATED, attr.span, - fluent::lint::builtin_deprecated_attr_used, + fluent::lint_builtin_deprecated_attr_used, |lint| { lint.set_arg("name", pprust::path_to_string(&attr.get_normal_item().path)) .span_suggestion_short( attr.span, - fluent::lint::builtin_deprecated_attr_default_suggestion, + fluent::lint_builtin_deprecated_attr_default_suggestion, "", Applicability::MachineApplicable, ) @@ -1039,14 +1036,14 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: & cx.struct_span_lint( UNUSED_DOC_COMMENTS, span, - fluent::lint::builtin_unused_doc_comment, + fluent::lint_builtin_unused_doc_comment, |lint| { - lint.set_arg("kind", node_kind).span_label(node_span, fluent::lint::label).help( + lint.set_arg("kind", node_kind).span_label(node_span, fluent::label).help( match attr.kind { AttrKind::DocComment(CommentKind::Line, _) | AttrKind::Normal(..) => { - fluent::lint::plain_help + fluent::plain_help } - AttrKind::DocComment(CommentKind::Block, _) => fluent::lint::block_help, + AttrKind::DocComment(CommentKind::Block, _) => fluent::block_help, }, ) }, @@ -1167,11 +1164,11 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { cx.struct_span_lint( NO_MANGLE_GENERIC_ITEMS, span, - fluent::lint::builtin_no_mangle_generic, + fluent::lint_builtin_no_mangle_generic, |lint| { lint.span_suggestion_short( no_mangle_attr.span, - fluent::lint::suggestion, + fluent::suggestion, "", // Use of `#[no_mangle]` suggests FFI intent; correct // fix may be to monomorphize source by hand @@ -1197,7 +1194,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { cx.struct_span_lint( NO_MANGLE_CONST_ITEMS, it.span, - fluent::lint::builtin_const_no_mangle, + fluent::lint_builtin_const_no_mangle, |lint| { // account for "pub const" (#45562) let start = cx @@ -1211,7 +1208,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems { let const_span = it.span.with_hi(BytePos(it.span.lo().0 + start + 5)); lint.span_suggestion( const_span, - fluent::lint::suggestion, + fluent::suggestion, "pub static", Applicability::MachineApplicable, ) @@ -1279,7 +1276,7 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes { cx.struct_span_lint( MUTABLE_TRANSMUTES, expr.span, - fluent::lint::builtin_mutable_transmutes, + fluent::lint_builtin_mutable_transmutes, |lint| lint, ); } @@ -1332,7 +1329,7 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures { cx.struct_span_lint( UNSTABLE_FEATURES, item.span(), - fluent::lint::builtin_unstable_features, + fluent::lint_builtin_unstable_features, |lint| lint, ); } @@ -1396,18 +1393,13 @@ impl UnreachablePub { cx.struct_span_lint( UNREACHABLE_PUB, def_span, - fluent::lint::builtin_unreachable_pub, + fluent::lint_builtin_unreachable_pub, |lint| { lint.set_arg("what", what); - lint.span_suggestion( - vis_span, - fluent::lint::suggestion, - "pub(crate)", - applicability, - ); + lint.span_suggestion(vis_span, fluent::suggestion, "pub(crate)", applicability); if exportable { - lint.help(fluent::lint::help); + lint.help(fluent::help); } lint }, @@ -1498,7 +1490,7 @@ impl TypeAliasBounds { impl Visitor<'_> for WalkAssocTypes<'_> { fn visit_qpath(&mut self, qpath: &hir::QPath<'_>, id: hir::HirId, span: Span) { if TypeAliasBounds::is_type_variable_assoc(qpath) { - self.err.span_help(span, fluent::lint::builtin_type_alias_bounds_help); + self.err.span_help(span, fluent::lint_builtin_type_alias_bounds_help); } intravisit::walk_qpath(self, qpath, id) } @@ -1541,11 +1533,11 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { let mut suggested_changing_assoc_types = false; if !where_spans.is_empty() { - cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint::builtin_type_alias_where_clause, |lint| { + cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint_builtin_type_alias_where_clause, |lint| { lint.set_span(where_spans); lint.span_suggestion( type_alias_generics.where_clause_span, - fluent::lint::suggestion, + fluent::suggestion, "", Applicability::MachineApplicable, ); @@ -1558,10 +1550,10 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { } if !inline_spans.is_empty() { - cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint::builtin_type_alias_generic_bounds, |lint| { + cx.lint(TYPE_ALIAS_BOUNDS, fluent::lint_builtin_type_alias_generic_bounds, |lint| { lint.set_span(inline_spans); lint.multipart_suggestion( - fluent::lint::suggestion, + fluent::suggestion, inline_sugg, Applicability::MachineApplicable, ); @@ -1670,7 +1662,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints { cx.struct_span_lint( TRIVIAL_BOUNDS, span, - fluent::lint::builtin_trivial_bounds, + fluent::lint_builtin_trivial_bounds, |lint| { lint.set_arg("predicate_kind_name", predicate_kind_name) .set_arg("predicate", predicate) @@ -1775,8 +1767,8 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { }; if let Some((start, end, join)) = endpoints { - let msg = fluent::lint::builtin_ellipsis_inclusive_range_patterns; - let suggestion = fluent::lint::suggestion; + let msg = fluent::lint_builtin_ellipsis_inclusive_range_patterns; + let suggestion = fluent::suggestion; if parenthesise { self.node_id = Some(pat.id); let end = expr_to_string(&end); @@ -1899,7 +1891,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnameableTestItems { cx.struct_span_lint( UNNAMEABLE_TEST_ITEMS, attr.span, - fluent::lint::builtin_unnameable_test_items, + fluent::lint_builtin_unnameable_test_items, |lint| lint, ); } @@ -2020,11 +2012,11 @@ impl KeywordIdents { cx.struct_span_lint( KEYWORD_IDENTS, ident.span, - fluent::lint::builtin_keyword_idents, + fluent::lint_builtin_keyword_idents, |lint| { lint.set_arg("kw", ident.clone()).set_arg("next", next_edition).span_suggestion( ident.span, - fluent::lint::suggestion, + fluent::suggestion, format!("r#{}", ident), Applicability::MachineApplicable, ) @@ -2283,10 +2275,10 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements { cx.struct_span_lint( EXPLICIT_OUTLIVES_REQUIREMENTS, lint_spans.clone(), - fluent::lint::builtin_explicit_outlives, + fluent::lint_builtin_explicit_outlives, |lint| { lint.set_arg("count", bound_count).multipart_suggestion( - fluent::lint::suggestion, + fluent::suggestion, lint_spans .into_iter() .map(|span| (span, String::new())) @@ -2344,17 +2336,17 @@ impl EarlyLintPass for IncompleteFeatures { cx.struct_span_lint( INCOMPLETE_FEATURES, span, - fluent::lint::builtin_incomplete_features, + fluent::lint_builtin_incomplete_features, |lint| { lint.set_arg("name", name); if let Some(n) = rustc_feature::find_feature_issue(name, GateIssue::Language) { lint.set_arg("n", n); - lint.note(fluent::lint::note); + lint.note(fluent::note); } if HAS_MIN_FEATURES.contains(&name) { - lint.help(fluent::lint::help); + lint.help(fluent::help); } lint }, @@ -3015,9 +3007,9 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations { // Finally, emit the diagnostic. let msg = if orig.get_name() == this_fi.ident.name { - fluent::lint::builtin_clashing_extern_same_name + fluent::lint_builtin_clashing_extern_same_name } else { - fluent::lint::builtin_clashing_extern_diff_name + fluent::lint_builtin_clashing_extern_diff_name }; tcx.struct_span_lint_hir( CLASHING_EXTERN_DECLARATIONS, @@ -3032,14 +3024,8 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations { lint.set_arg("this_fi", this_fi.ident.name) .set_arg("orig", orig.get_name()) - .span_label( - get_relevant_span(orig_fi), - fluent::lint::previous_decl_label, - ) - .span_label( - get_relevant_span(this_fi), - fluent::lint::mismatch_label, - ) + .span_label(get_relevant_span(orig_fi), fluent::previous_decl_label) + .span_label(get_relevant_span(this_fi), fluent::mismatch_label) // FIXME(davidtwco): translatable expected/found .note_expected_found(&"", expected_str, &"", found_str) }, @@ -3125,8 +3111,8 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr { cx.struct_span_lint( DEREF_NULLPTR, expr.span, - fluent::lint::builtin_deref_nullptr, - |lint| lint.span_label(expr.span, fluent::lint::label), + fluent::lint_builtin_deref_nullptr, + |lint| lint.span_label(expr.span, fluent::label), ); } } @@ -3238,7 +3224,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels { cx.lookup_with_diagnostics( NAMED_ASM_LABELS, Some(target_spans), - fluent::lint::builtin_asm_labels, + fluent::lint_builtin_asm_labels, |lint| lint, BuiltinLintDiagnostics::NamedAsmLabel( "only local labels of the form `<number>:` should be used in inline asm" @@ -3341,8 +3327,8 @@ impl EarlyLintPass for UnexpectedCfgs { cx.lookup( UNEXPECTED_CFGS, None::<MultiSpan>, - fluent::lint::builtin_unexpected_cli_config_name, - |diag| diag.help(fluent::lint::help).set_arg("name", name), + fluent::lint_builtin_unexpected_cli_config_name, + |diag| diag.help(fluent::help).set_arg("name", name), ); } } @@ -3352,9 +3338,9 @@ impl EarlyLintPass for UnexpectedCfgs { cx.lookup( UNEXPECTED_CFGS, None::<MultiSpan>, - fluent::lint::builtin_unexpected_cli_config_value, + fluent::lint_builtin_unexpected_cli_config_value, |diag| { - diag.help(fluent::lint::help) + diag.help(fluent::help) .set_arg("name", name) .set_arg("value", value) }, diff --git a/compiler/rustc_lint/src/enum_intrinsics_non_enums.rs b/compiler/rustc_lint/src/enum_intrinsics_non_enums.rs index e8d307814b9..f9d7466228a 100644 --- a/compiler/rustc_lint/src/enum_intrinsics_non_enums.rs +++ b/compiler/rustc_lint/src/enum_intrinsics_non_enums.rs @@ -53,8 +53,8 @@ fn enforce_mem_discriminant( cx.struct_span_lint( ENUM_INTRINSICS_NON_ENUMS, expr_span, - fluent::lint::enum_intrinsics_mem_discriminant, - |lint| lint.set_arg("ty_param", ty_param).span_note(args_span, fluent::lint::note), + fluent::lint_enum_intrinsics_mem_discriminant, + |lint| lint.set_arg("ty_param", ty_param).span_note(args_span, fluent::note), ); } } @@ -65,8 +65,8 @@ fn enforce_mem_variant_count(cx: &LateContext<'_>, func_expr: &hir::Expr<'_>, sp cx.struct_span_lint( ENUM_INTRINSICS_NON_ENUMS, span, - fluent::lint::enum_intrinsics_mem_variant, - |lint| lint.set_arg("ty_param", ty_param).note(fluent::lint::note), + fluent::lint_enum_intrinsics_mem_variant, + |lint| lint.set_arg("ty_param", ty_param).note(fluent::note), ); } } diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs index 34b70030a58..a49d1bdacc2 100644 --- a/compiler/rustc_lint/src/errors.rs +++ b/compiler/rustc_lint/src/errors.rs @@ -7,7 +7,7 @@ use rustc_session::lint::Level; use rustc_span::{Span, Symbol}; #[derive(Diagnostic)] -#[diag(lint::overruled_attribute, code = "E0453")] +#[diag(lint_overruled_attribute, code = "E0453")] pub struct OverruledAttribute { #[primary_span] pub span: Span, @@ -32,24 +32,24 @@ impl AddToDiagnostic for OverruledAttributeSub { { match self { OverruledAttributeSub::DefaultSource { id } => { - diag.note(fluent::lint::default_source); + diag.note(fluent::lint_default_source); diag.set_arg("id", id); } OverruledAttributeSub::NodeSource { span, reason } => { - diag.span_label(span, fluent::lint::node_source); + diag.span_label(span, fluent::lint_node_source); if let Some(rationale) = reason { diag.note(rationale.as_str()); } } OverruledAttributeSub::CommandLineSource => { - diag.note(fluent::lint::command_line_source); + diag.note(fluent::lint_command_line_source); } } } } #[derive(Diagnostic)] -#[diag(lint::malformed_attribute, code = "E0452")] +#[diag(lint_malformed_attribute, code = "E0452")] pub struct MalformedAttribute { #[primary_span] pub span: Span, @@ -59,16 +59,16 @@ pub struct MalformedAttribute { #[derive(Subdiagnostic)] pub enum MalformedAttributeSub { - #[label(lint::bad_attribute_argument)] + #[label(lint_bad_attribute_argument)] BadAttributeArgument(#[primary_span] Span), - #[label(lint::reason_must_be_string_literal)] + #[label(lint_reason_must_be_string_literal)] ReasonMustBeStringLiteral(#[primary_span] Span), - #[label(lint::reason_must_come_last)] + #[label(lint_reason_must_come_last)] ReasonMustComeLast(#[primary_span] Span), } #[derive(Diagnostic)] -#[diag(lint::unknown_tool_in_scoped_lint, code = "E0710")] +#[diag(lint_unknown_tool_in_scoped_lint, code = "E0710")] pub struct UnknownToolInScopedLint { #[primary_span] pub span: Option<Span>, @@ -79,7 +79,7 @@ pub struct UnknownToolInScopedLint { } #[derive(Diagnostic)] -#[diag(lint::builtin_ellipsis_inclusive_range_patterns, code = "E0783")] +#[diag(lint_builtin_ellipsis_inclusive_range_patterns, code = "E0783")] pub struct BuiltinEllpisisInclusiveRangePatterns { #[primary_span] pub span: Span, @@ -89,14 +89,14 @@ pub struct BuiltinEllpisisInclusiveRangePatterns { } #[derive(Subdiagnostic)] -#[note(lint::requested_level)] +#[note(lint_requested_level)] pub struct RequestedLevel { pub level: Level, pub lint_name: String, } #[derive(Diagnostic)] -#[diag(lint::unsupported_group, code = "E0602")] +#[diag(lint_unsupported_group, code = "E0602")] pub struct UnsupportedGroup { pub lint_group: String, } @@ -112,10 +112,10 @@ impl IntoDiagnostic<'_> for CheckNameUnknown { self, handler: &Handler, ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { - let mut diag = handler.struct_err(fluent::lint::check_name_unknown); + let mut diag = handler.struct_err(fluent::lint_check_name_unknown); diag.code(rustc_errors::error_code!(E0602)); if let Some(suggestion) = self.suggestion { - diag.help(fluent::lint::help); + diag.help(fluent::help); diag.set_arg("suggestion", suggestion); } diag.set_arg("lint_name", self.lint_name); @@ -125,7 +125,7 @@ impl IntoDiagnostic<'_> for CheckNameUnknown { } #[derive(Diagnostic)] -#[diag(lint::check_name_unknown_tool, code = "E0602")] +#[diag(lint_check_name_unknown_tool, code = "E0602")] pub struct CheckNameUnknownTool { pub tool_name: Symbol, #[subdiagnostic] @@ -133,7 +133,7 @@ pub struct CheckNameUnknownTool { } #[derive(Diagnostic)] -#[diag(lint::check_name_warning)] +#[diag(lint_check_name_warning)] pub struct CheckNameWarning { pub msg: String, #[subdiagnostic] @@ -141,7 +141,7 @@ pub struct CheckNameWarning { } #[derive(Diagnostic)] -#[diag(lint::check_name_deprecated)] +#[diag(lint_check_name_deprecated)] pub struct CheckNameDeprecated { pub lint_name: String, pub new_name: String, diff --git a/compiler/rustc_lint/src/expect.rs b/compiler/rustc_lint/src/expect.rs index 4c3c39734dd..cf8f31bcbd0 100644 --- a/compiler/rustc_lint/src/expect.rs +++ b/compiler/rustc_lint/src/expect.rs @@ -45,14 +45,14 @@ fn emit_unfulfilled_expectation_lint( builtin::UNFULFILLED_LINT_EXPECTATIONS, hir_id, expectation.emission_span, - fluent::lint::expectation, + fluent::lint_expectation, |lint| { if let Some(rationale) = expectation.reason { lint.note(rationale.as_str()); } if expectation.is_unfulfilled_lint_expectations { - lint.note(fluent::lint::note); + lint.note(fluent::note); } lint diff --git a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs index 42557068bd3..7e884e990ce 100644 --- a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs +++ b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs @@ -63,12 +63,12 @@ impl HiddenUnicodeCodepoints { cx.struct_span_lint( TEXT_DIRECTION_CODEPOINT_IN_LITERAL, span, - fluent::lint::hidden_unicode_codepoints, + fluent::lint_hidden_unicode_codepoints, |lint| { lint.set_arg("label", label); lint.set_arg("count", spans.len()); - lint.span_label(span, fluent::lint::label); - lint.note(fluent::lint::note); + lint.span_label(span, fluent::label); + lint.note(fluent::note); if point_at_inner_spans { for (c, span) in &spans { lint.span_label(*span, format!("{:?}", c)); @@ -76,13 +76,13 @@ impl HiddenUnicodeCodepoints { } if point_at_inner_spans && !spans.is_empty() { lint.multipart_suggestion_with_style( - fluent::lint::suggestion_remove, + fluent::suggestion_remove, spans.iter().map(|(_, span)| (*span, "".to_string())).collect(), Applicability::MachineApplicable, SuggestionStyle::HideCodeAlways, ); lint.multipart_suggestion( - fluent::lint::suggestion_escape, + fluent::suggestion_escape, spans .into_iter() .map(|(c, span)| { @@ -104,8 +104,8 @@ impl HiddenUnicodeCodepoints { .collect::<Vec<String>>() .join(", "), ); - lint.note(fluent::lint::suggestion_remove); - lint.note(fluent::lint::no_suggestion_note_escape); + lint.note(fluent::suggestion_remove); + lint.note(fluent::no_suggestion_note_escape); } lint }, diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 8f5e38fdbcc..11e4650cb4b 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -37,11 +37,11 @@ impl LateLintPass<'_> for DefaultHashTypes { cx.struct_span_lint( DEFAULT_HASH_TYPES, path.span, - fluent::lint::default_hash_types, + fluent::lint_default_hash_types, |lint| { lint.set_arg("preferred", replace) .set_arg("used", cx.tcx.item_name(def_id)) - .note(fluent::lint::note) + .note(fluent::note) }, ); } @@ -86,8 +86,8 @@ impl LateLintPass<'_> for QueryStability { cx.struct_span_lint( POTENTIAL_QUERY_INSTABILITY, span, - fluent::lint::query_instability, - |lint| lint.set_arg("query", cx.tcx.item_name(def_id)).note(fluent::lint::note), + fluent::lint_query_instability, + |lint| lint.set_arg("query", cx.tcx.item_name(def_id)).note(fluent::note), ) } } @@ -126,11 +126,11 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { let span = path.span.with_hi( segment.args.map_or(segment.ident.span, |a| a.span_ext).hi() ); - cx.struct_span_lint(USAGE_OF_TY_TYKIND, path.span, fluent::lint::tykind_kind, |lint| { + cx.struct_span_lint(USAGE_OF_TY_TYKIND, path.span, fluent::lint_tykind_kind, |lint| { lint .span_suggestion( span, - fluent::lint::suggestion, + fluent::suggestion, "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) @@ -193,10 +193,10 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { cx.struct_span_lint( USAGE_OF_TY_TYKIND, path.span, - fluent::lint::tykind_kind, + fluent::lint_tykind_kind, |lint| lint.span_suggestion( span, - fluent::lint::suggestion, + fluent::suggestion, "ty", Applicability::MaybeIncorrect, // ty maybe needs an import ) @@ -205,18 +205,18 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind { None => cx.struct_span_lint( USAGE_OF_TY_TYKIND, path.span, - fluent::lint::tykind, - |lint| lint.help(fluent::lint::help) + fluent::lint_tykind, + |lint| lint.help(fluent::help) ) } } else if !ty.span.from_expansion() && let Some(t) = is_ty_or_ty_ctxt(cx, &path) { if path.segments.len() > 1 { - cx.struct_span_lint(USAGE_OF_QUALIFIED_TY, path.span, fluent::lint::ty_qualified, |lint| { + cx.struct_span_lint(USAGE_OF_QUALIFIED_TY, path.span, fluent::lint_ty_qualified, |lint| { lint .set_arg("ty", t.clone()) .span_suggestion( path.span, - fluent::lint::suggestion, + fluent::suggestion, t, // The import probably needs to be changed Applicability::MaybeIncorrect, @@ -310,8 +310,8 @@ impl EarlyLintPass for LintPassImpl { cx.struct_span_lint( LINT_PASS_IMPL_WITHOUT_MACRO, lint_pass.path.span, - fluent::lint::lintpass_by_hand, - |lint| lint.help(fluent::lint::help), + fluent::lint_lintpass_by_hand, + |lint| lint.help(fluent::help), ) } } @@ -351,8 +351,8 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword { cx.struct_span_lint( EXISTING_DOC_KEYWORD, attr.span, - fluent::lint::non_existant_doc_keyword, - |lint| lint.set_arg("keyword", v).help(fluent::lint::help), + fluent::lint_non_existant_doc_keyword, + |lint| lint.set_arg("keyword", v).help(fluent::help), ); } } @@ -414,7 +414,7 @@ impl LateLintPass<'_> for Diagnostics { cx.struct_span_lint( DIAGNOSTIC_OUTSIDE_OF_IMPL, span, - fluent::lint::diag_out_of_impl, + fluent::lint_diag_out_of_impl, |lint| lint, ) } @@ -435,7 +435,7 @@ impl LateLintPass<'_> for Diagnostics { cx.struct_span_lint( UNTRANSLATABLE_DIAGNOSTIC, span, - fluent::lint::untranslatable_diag, + fluent::lint_untranslatable_diag, |lint| lint, ) } diff --git a/compiler/rustc_lint/src/methods.rs b/compiler/rustc_lint/src/methods.rs index 313119637bc..e2d7d5b49f6 100644 --- a/compiler/rustc_lint/src/methods.rs +++ b/compiler/rustc_lint/src/methods.rs @@ -93,12 +93,12 @@ fn lint_cstring_as_ptr( cx.struct_span_lint( TEMPORARY_CSTRING_AS_PTR, as_ptr_span, - fluent::lint::cstring_ptr, + fluent::lint_cstring_ptr, |diag| { - diag.span_label(as_ptr_span, fluent::lint::as_ptr_label) - .span_label(unwrap.span, fluent::lint::unwrap_label) - .note(fluent::lint::note) - .help(fluent::lint::help) + diag.span_label(as_ptr_span, fluent::as_ptr_label) + .span_label(unwrap.span, fluent::unwrap_label) + .note(fluent::note) + .help(fluent::help) }, ); } diff --git a/compiler/rustc_lint/src/non_ascii_idents.rs b/compiler/rustc_lint/src/non_ascii_idents.rs index b2626efb6d7..dea9506acb2 100644 --- a/compiler/rustc_lint/src/non_ascii_idents.rs +++ b/compiler/rustc_lint/src/non_ascii_idents.rs @@ -183,7 +183,7 @@ impl EarlyLintPass for NonAsciiIdents { cx.struct_span_lint( NON_ASCII_IDENTS, sp, - fluent::lint::identifier_non_ascii_char, + fluent::lint_identifier_non_ascii_char, |lint| lint, ); if check_uncommon_codepoints @@ -192,7 +192,7 @@ impl EarlyLintPass for NonAsciiIdents { cx.struct_span_lint( UNCOMMON_CODEPOINTS, sp, - fluent::lint::identifier_uncommon_codepoints, + fluent::lint_identifier_uncommon_codepoints, |lint| lint, ) } @@ -225,11 +225,11 @@ impl EarlyLintPass for NonAsciiIdents { cx.struct_span_lint( CONFUSABLE_IDENTS, sp, - fluent::lint::confusable_identifier_pair, + fluent::lint_confusable_identifier_pair, |lint| { lint.set_arg("existing_sym", *existing_symbol) .set_arg("sym", symbol) - .span_label(*existing_span, fluent::lint::label) + .span_label(*existing_span, fluent::label) }, ); } @@ -334,7 +334,7 @@ impl EarlyLintPass for NonAsciiIdents { cx.struct_span_lint( MIXED_SCRIPT_CONFUSABLES, sp, - fluent::lint::mixed_script_confusables, + fluent::lint_mixed_script_confusables, |lint| { let mut includes = String::new(); for (idx, ch) in ch_list.into_iter().enumerate() { @@ -346,8 +346,8 @@ impl EarlyLintPass for NonAsciiIdents { } lint.set_arg("set", script_set.to_string()) .set_arg("includes", includes) - .note(fluent::lint::includes_note) - .note(fluent::lint::note) + .note(fluent::includes_note) + .note(fluent::note) }, ); } diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index 886b686e5e8..6ad2e0294b9 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -119,20 +119,20 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc arg_span = expn.call_site; } - cx.struct_span_lint(NON_FMT_PANICS, arg_span, fluent::lint::non_fmt_panic, |lint| { + cx.struct_span_lint(NON_FMT_PANICS, arg_span, fluent::lint_non_fmt_panic, |lint| { lint.set_arg("name", symbol); - lint.note(fluent::lint::note); - lint.note(fluent::lint::more_info_note); + lint.note(fluent::note); + lint.note(fluent::more_info_note); if !is_arg_inside_call(arg_span, span) { // No clue where this argument is coming from. return lint; } if arg_macro.map_or(false, |id| cx.tcx.is_diagnostic_item(sym::format_macro, id)) { // A case of `panic!(format!(..))`. - lint.note(fluent::lint::supports_fmt_note); + lint.note(fluent::supports_fmt_note); if let Some((open, close, _)) = find_delimiters(cx, arg_span) { lint.multipart_suggestion( - fluent::lint::supports_fmt_suggestion, + fluent::supports_fmt_suggestion, vec![ (arg_span.until(open.shrink_to_hi()), "".into()), (close.until(arg_span.shrink_to_hi()), "".into()), @@ -178,7 +178,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc if suggest_display { lint.span_suggestion_verbose( arg_span.shrink_to_lo(), - fluent::lint::display_suggestion, + fluent::display_suggestion, "\"{}\", ", fmt_applicability, ); @@ -186,7 +186,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc lint.set_arg("ty", ty); lint.span_suggestion_verbose( arg_span.shrink_to_lo(), - fluent::lint::debug_suggestion, + fluent::debug_suggestion, "\"{:?}\", ", fmt_applicability, ); @@ -196,7 +196,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc if let Some((open, close, del)) = find_delimiters(cx, span) { lint.set_arg("already_suggested", suggest_display || suggest_debug); lint.multipart_suggestion( - fluent::lint::panic_suggestion, + fluent::panic_suggestion, if del == '(' { vec![(span.until(open), "std::panic::panic_any".into())] } else { @@ -254,30 +254,25 @@ fn check_panic_str<'tcx>( .map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end))) .collect(), }; - cx.struct_span_lint( - NON_FMT_PANICS, - arg_spans, - fluent::lint::non_fmt_panic_unused, - |lint| { - lint.set_arg("count", n_arguments); - lint.note(fluent::lint::note); - if is_arg_inside_call(arg.span, span) { - lint.span_suggestion( - arg.span.shrink_to_hi(), - fluent::lint::add_args_suggestion, - ", ...", - Applicability::HasPlaceholders, - ); - lint.span_suggestion( - arg.span.shrink_to_lo(), - fluent::lint::add_fmt_suggestion, - "\"{}\", ", - Applicability::MachineApplicable, - ); - } - lint - }, - ); + cx.struct_span_lint(NON_FMT_PANICS, arg_spans, fluent::lint_non_fmt_panic_unused, |lint| { + lint.set_arg("count", n_arguments); + lint.note(fluent::note); + if is_arg_inside_call(arg.span, span) { + lint.span_suggestion( + arg.span.shrink_to_hi(), + fluent::add_args_suggestion, + ", ...", + Applicability::HasPlaceholders, + ); + lint.span_suggestion( + arg.span.shrink_to_lo(), + fluent::add_fmt_suggestion, + "\"{}\", ", + Applicability::MachineApplicable, + ); + } + lint + }); } else { let brace_spans: Option<Vec<_>> = snippet.filter(|s| s.starts_with('"') || s.starts_with("r#")).map(|s| { @@ -290,14 +285,14 @@ fn check_panic_str<'tcx>( cx.struct_span_lint( NON_FMT_PANICS, brace_spans.unwrap_or_else(|| vec![span]), - fluent::lint::non_fmt_panic_braces, + fluent::lint_non_fmt_panic_braces, |lint| { lint.set_arg("count", count); - lint.note(fluent::lint::note); + lint.note(fluent::note); if is_arg_inside_call(arg.span, span) { lint.span_suggestion( arg.span.shrink_to_lo(), - fluent::lint::suggestion, + fluent::suggestion, "\"{}\", ", Applicability::MachineApplicable, ); diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index 6b32e78b910..7e50801f80c 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -139,7 +139,7 @@ impl NonCamelCaseTypes { cx.struct_span_lint( NON_CAMEL_CASE_TYPES, ident.span, - fluent::lint::non_camel_case_type, + fluent::lint_non_camel_case_type, |lint| { let cc = to_camel_case(name); // We cannot provide meaningful suggestions @@ -147,12 +147,12 @@ impl NonCamelCaseTypes { if *name != cc { lint.span_suggestion( ident.span, - fluent::lint::suggestion, + fluent::suggestion, to_camel_case(name), Applicability::MaybeIncorrect, ); } else { - lint.span_label(ident.span, fluent::lint::label); + lint.span_label(ident.span, fluent::label); } lint.set_arg("sort", sort); @@ -284,7 +284,7 @@ impl NonSnakeCase { let name = ident.name.as_str(); if !is_snake_case(name) { - cx.struct_span_lint(NON_SNAKE_CASE, ident.span, fluent::lint::non_snake_case, |lint| { + cx.struct_span_lint(NON_SNAKE_CASE, ident.span, fluent::lint_non_snake_case, |lint| { let sc = NonSnakeCase::to_snake_case(name); // We cannot provide meaningful suggestions // if the characters are in the category of "Uppercase Letter". @@ -298,13 +298,13 @@ impl NonSnakeCase { // Instead, recommend renaming the identifier entirely or, if permitted, // escaping it to create a raw identifier. if sc_ident.name.can_be_raw() { - (fluent::lint::rename_or_convert_suggestion, sc_ident.to_string()) + (fluent::rename_or_convert_suggestion, sc_ident.to_string()) } else { - lint.note(fluent::lint::cannot_convert_note); - (fluent::lint::rename_suggestion, String::new()) + lint.note(fluent::cannot_convert_note); + (fluent::rename_suggestion, String::new()) } } else { - (fluent::lint::convert_suggestion, sc.clone()) + (fluent::convert_suggestion, sc.clone()) }; lint.span_suggestion( @@ -314,10 +314,10 @@ impl NonSnakeCase { Applicability::MaybeIncorrect, ); } else { - lint.help(fluent::lint::help); + lint.help(fluent::help); } } else { - lint.span_label(ident.span, fluent::lint::label); + lint.span_label(ident.span, fluent::label); } lint.set_arg("sort", sort); @@ -484,7 +484,7 @@ impl NonUpperCaseGlobals { cx.struct_span_lint( NON_UPPER_CASE_GLOBALS, ident.span, - fluent::lint::non_upper_case_global, + fluent::lint_non_upper_case_global, |lint| { let uc = NonSnakeCase::to_snake_case(&name).to_uppercase(); // We cannot provide meaningful suggestions @@ -492,12 +492,12 @@ impl NonUpperCaseGlobals { if *name != uc { lint.span_suggestion( ident.span, - fluent::lint::suggestion, + fluent::suggestion, uc, Applicability::MaybeIncorrect, ); } else { - lint.span_label(ident.span, fluent::lint::label); + lint.span_label(ident.span, fluent::label); } lint.set_arg("sort", sort); diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs index 9a62afd3caf..2ef425a1093 100644 --- a/compiler/rustc_lint/src/noop_method_call.rs +++ b/compiler/rustc_lint/src/noop_method_call.rs @@ -85,11 +85,11 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { } let expr_span = expr.span; let span = expr_span.with_lo(receiver.span.hi()); - cx.struct_span_lint(NOOP_METHOD_CALL, span, fluent::lint::noop_method_call, |lint| { + cx.struct_span_lint(NOOP_METHOD_CALL, span, fluent::lint_noop_method_call, |lint| { lint.set_arg("method", call.ident.name) .set_arg("receiver_ty", receiver_ty) - .span_label(span, fluent::lint::label) - .note(fluent::lint::note) + .span_label(span, fluent::label) + .note(fluent::note) }); } } diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index e0958b039dc..7f6f4a0abb4 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -139,11 +139,11 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound { } #[derive(LintDiagnostic)] -#[diag(lint::opaque_hidden_inferred_bound)] +#[diag(lint_opaque_hidden_inferred_bound)] struct OpaqueHiddenInferredBoundLint<'tcx> { ty: Ty<'tcx>, proj_ty: Ty<'tcx>, - #[label(lint::specifically)] + #[label(specifically)] assoc_pred_span: Span, #[subdiagnostic] add_bound: Option<AddBound<'tcx>>, @@ -151,7 +151,7 @@ struct OpaqueHiddenInferredBoundLint<'tcx> { #[derive(Subdiagnostic)] #[suggestion_verbose( - lint::opaque_hidden_inferred_bound_sugg, + lint_opaque_hidden_inferred_bound_sugg, applicability = "machine-applicable", code = " + {trait_ref}" )] diff --git a/compiler/rustc_lint/src/pass_by_value.rs b/compiler/rustc_lint/src/pass_by_value.rs index 349399b5964..01bface718a 100644 --- a/compiler/rustc_lint/src/pass_by_value.rs +++ b/compiler/rustc_lint/src/pass_by_value.rs @@ -32,11 +32,11 @@ impl<'tcx> LateLintPass<'tcx> for PassByValue { cx.struct_span_lint( PASS_BY_VALUE, ty.span, - fluent::lint::pass_by_value, + fluent::lint_pass_by_value, |lint| { lint.set_arg("ty", t.clone()).span_suggestion( ty.span, - fluent::lint::suggestion, + fluent::suggestion, t, // Changing type of function argument Applicability::MaybeIncorrect, diff --git a/compiler/rustc_lint/src/redundant_semicolon.rs b/compiler/rustc_lint/src/redundant_semicolon.rs index 46c84550e9f..3521de7fc08 100644 --- a/compiler/rustc_lint/src/redundant_semicolon.rs +++ b/compiler/rustc_lint/src/redundant_semicolon.rs @@ -51,11 +51,11 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo cx.struct_span_lint( REDUNDANT_SEMICOLONS, span, - fluent::lint::redundant_semicolons, + fluent::lint_redundant_semicolons, |lint| { lint.set_arg("multiple", multiple).span_suggestion( span, - fluent::lint::suggestion, + fluent::suggestion, "", Applicability::MaybeIncorrect, ) diff --git a/compiler/rustc_lint/src/traits.rs b/compiler/rustc_lint/src/traits.rs index 078465bdce6..a118dda8b40 100644 --- a/compiler/rustc_lint/src/traits.rs +++ b/compiler/rustc_lint/src/traits.rs @@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { cx.struct_span_lint( DROP_BOUNDS, span, - fluent::lint::drop_trait_constraints, + fluent::lint_drop_trait_constraints, |lint| { lint.set_arg("predicate", predicate) .set_arg("needs_drop", cx.tcx.def_path_str(needs_drop)) @@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { if cx.tcx.lang_items().drop_trait() == def_id && let Some(needs_drop) = cx.tcx.get_diagnostic_item(sym::needs_drop) { - cx.struct_span_lint(DYN_DROP, bound.span, fluent::lint::drop_glue, |lint| { + cx.struct_span_lint(DYN_DROP, bound.span, fluent::lint_drop_glue, |lint| { lint.set_arg("needs_drop", cx.tcx.def_path_str(needs_drop)) }); } diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 3cdca217865..7c99bb2790f 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -151,7 +151,7 @@ fn lint_overflowing_range_endpoint<'tcx>( cx.struct_span_lint( OVERFLOWING_LITERALS, struct_expr.span, - fluent::lint::range_endpoint_out_of_range, + fluent::lint_range_endpoint_out_of_range, |lint| { use ast::{LitIntType, LitKind}; @@ -168,7 +168,7 @@ fn lint_overflowing_range_endpoint<'tcx>( let suggestion = format!("{}..={}{}", start, lit_val - 1, suffix); lint.span_suggestion( struct_expr.span, - fluent::lint::suggestion, + fluent::suggestion, suggestion, Applicability::MachineApplicable, ); @@ -233,7 +233,7 @@ fn report_bin_hex_error( cx.struct_span_lint( OVERFLOWING_LITERALS, expr.span, - fluent::lint::overflowing_bin_hex, + fluent::lint_overflowing_bin_hex, |lint| { let (t, actually) = match ty { attr::IntType::SignedInt(t) => { @@ -253,10 +253,10 @@ fn report_bin_hex_error( if negative { // If the value is negative, // emits a note about the value itself, apart from the literal. - lint.note(fluent::lint::negative_note); - lint.note(fluent::lint::negative_becomes_note); + lint.note(fluent::negative_note); + lint.note(fluent::negative_becomes_note); } else { - lint.note(fluent::lint::positive_note); + lint.note(fluent::positive_note); } if let Some(sugg_ty) = get_type_suggestion(cx.typeck_results().node_type(expr.hir_id), val, negative) @@ -266,12 +266,12 @@ fn report_bin_hex_error( let (sans_suffix, _) = repr_str.split_at(pos); lint.span_suggestion( expr.span, - fluent::lint::suggestion, + fluent::suggestion, format!("{}{}", sans_suffix, sugg_ty), Applicability::MachineApplicable, ); } else { - lint.help(fluent::lint::help); + lint.help(fluent::help); } } lint.set_arg("ty", t) @@ -364,7 +364,7 @@ fn lint_int_literal<'tcx>( return; } - cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint::overflowing_int, |lint| { + cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint_overflowing_int, |lint| { lint.set_arg("ty", t.name_str()) .set_arg( "lit", @@ -375,13 +375,13 @@ fn lint_int_literal<'tcx>( ) .set_arg("min", min) .set_arg("max", max) - .note(fluent::lint::note); + .note(fluent::note); if let Some(sugg_ty) = get_type_suggestion(cx.typeck_results().node_type(e.hir_id), v, negative) { lint.set_arg("suggestion_ty", sugg_ty); - lint.help(fluent::lint::help); + lint.help(fluent::help); } lint @@ -412,11 +412,11 @@ fn lint_uint_literal<'tcx>( cx.struct_span_lint( OVERFLOWING_LITERALS, par_e.span, - fluent::lint::only_cast_u8_to_char, + fluent::lint_only_cast_u8_to_char, |lint| { lint.span_suggestion( par_e.span, - fluent::lint::suggestion, + fluent::suggestion, format!("'\\u{{{:X}}}'", lit_val), Applicability::MachineApplicable, ) @@ -443,7 +443,7 @@ fn lint_uint_literal<'tcx>( ); return; } - cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint::overflowing_uint, |lint| { + cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, fluent::lint_overflowing_uint, |lint| { lint.set_arg("ty", t.name_str()) .set_arg( "lit", @@ -454,7 +454,7 @@ fn lint_uint_literal<'tcx>( ) .set_arg("min", min) .set_arg("max", max) - .note(fluent::lint::note) + .note(fluent::note) }); } } @@ -487,7 +487,7 @@ fn lint_literal<'tcx>( cx.struct_span_lint( OVERFLOWING_LITERALS, e.span, - fluent::lint::overflowing_literal, + fluent::lint_overflowing_literal, |lint| { lint.set_arg("ty", t.name_str()) .set_arg( @@ -497,7 +497,7 @@ fn lint_literal<'tcx>( .span_to_snippet(lit.span) .expect("must get snippet from literal"), ) - .note(fluent::lint::note) + .note(fluent::note) }, ); } @@ -520,7 +520,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits { cx.struct_span_lint( UNUSED_COMPARISONS, e.span, - fluent::lint::unused_comparisons, + fluent::lint_unused_comparisons, |lint| lint, ); } @@ -842,8 +842,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { self.emit_ffi_unsafe_type_lint( ty, sp, - fluent::lint::improper_ctypes_array_reason, - Some(fluent::lint::improper_ctypes_array_help), + fluent::lint_improper_ctypes_array_reason, + Some(fluent::lint_improper_ctypes_array_help), ); true } else { @@ -886,7 +886,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } else { // All fields are ZSTs; this means that the type should behave // like (), which is FFI-unsafe - FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_struct_zst, help: None } + FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None } } } else { // We can't completely trust repr(C) markings; make sure the fields are @@ -900,7 +900,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { FfiPhantom(..) if def.is_enum() => { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_enum_phantomdata, + reason: fluent::lint_improper_ctypes_enum_phantomdata, help: None, }; } @@ -936,7 +936,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } else { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_box, + reason: fluent::lint_improper_ctypes_box, help: None, }; } @@ -950,14 +950,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { return FfiUnsafe { ty, reason: if def.is_struct() { - fluent::lint::improper_ctypes_struct_layout_reason + fluent::lint_improper_ctypes_struct_layout_reason } else { - fluent::lint::improper_ctypes_union_layout_reason + fluent::lint_improper_ctypes_union_layout_reason }, help: if def.is_struct() { - Some(fluent::lint::improper_ctypes_struct_layout_help) + Some(fluent::lint_improper_ctypes_struct_layout_help) } else { - Some(fluent::lint::improper_ctypes_union_layout_help) + Some(fluent::lint_improper_ctypes_union_layout_help) }, }; } @@ -968,9 +968,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { return FfiUnsafe { ty, reason: if def.is_struct() { - fluent::lint::improper_ctypes_struct_non_exhaustive + fluent::lint_improper_ctypes_struct_non_exhaustive } else { - fluent::lint::improper_ctypes_union_non_exhaustive + fluent::lint_improper_ctypes_union_non_exhaustive }, help: None, }; @@ -980,14 +980,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { return FfiUnsafe { ty, reason: if def.is_struct() { - fluent::lint::improper_ctypes_struct_fieldless_reason + fluent::lint_improper_ctypes_struct_fieldless_reason } else { - fluent::lint::improper_ctypes_union_fieldless_reason + fluent::lint_improper_ctypes_union_fieldless_reason }, help: if def.is_struct() { - Some(fluent::lint::improper_ctypes_struct_fieldless_help) + Some(fluent::lint_improper_ctypes_struct_fieldless_help) } else { - Some(fluent::lint::improper_ctypes_union_fieldless_help) + Some(fluent::lint_improper_ctypes_union_fieldless_help) }, }; } @@ -1008,8 +1008,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { if repr_nullable_ptr(self.cx, ty, self.mode).is_none() { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_enum_repr_reason, - help: Some(fluent::lint::improper_ctypes_enum_repr_help), + reason: fluent::lint_improper_ctypes_enum_repr_reason, + help: Some(fluent::lint_improper_ctypes_enum_repr_help), }; } } @@ -1017,7 +1017,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { if def.is_variant_list_non_exhaustive() && !def.did().is_local() { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_non_exhaustive, + reason: fluent::lint_improper_ctypes_non_exhaustive, help: None, }; } @@ -1028,7 +1028,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { if is_non_exhaustive && !variant.def_id.is_local() { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_non_exhaustive_variant, + reason: fluent::lint_improper_ctypes_non_exhaustive_variant, help: None, }; } @@ -1046,12 +1046,12 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { ty::Char => FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_char_reason, - help: Some(fluent::lint::improper_ctypes_char_help), + reason: fluent::lint_improper_ctypes_char_reason, + help: Some(fluent::lint_improper_ctypes_char_help), }, ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => { - FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_128bit, help: None } + FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None } } // Primitive types with a stable representation. @@ -1059,24 +1059,24 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { ty::Slice(_) => FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_slice_reason, - help: Some(fluent::lint::improper_ctypes_slice_help), + reason: fluent::lint_improper_ctypes_slice_reason, + help: Some(fluent::lint_improper_ctypes_slice_help), }, ty::Dynamic(..) => { - FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_dyn, help: None } + FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_dyn, help: None } } ty::Str => FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_str_reason, - help: Some(fluent::lint::improper_ctypes_str_help), + reason: fluent::lint_improper_ctypes_str_reason, + help: Some(fluent::lint_improper_ctypes_str_help), }, ty::Tuple(..) => FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_tuple_reason, - help: Some(fluent::lint::improper_ctypes_tuple_help), + reason: fluent::lint_improper_ctypes_tuple_reason, + help: Some(fluent::lint_improper_ctypes_tuple_help), }, ty::RawPtr(ty::TypeAndMut { ty, .. }) | ty::Ref(_, ty, _) @@ -1107,8 +1107,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { if self.is_internal_abi(sig.abi()) { return FfiUnsafe { ty, - reason: fluent::lint::improper_ctypes_fnptr_reason, - help: Some(fluent::lint::improper_ctypes_fnptr_help), + reason: fluent::lint_improper_ctypes_fnptr_reason, + help: Some(fluent::lint_improper_ctypes_fnptr_help), }; } @@ -1139,7 +1139,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // While opaque types are checked for earlier, if a projection in a struct field // normalizes to an opaque type, then it will reach this branch. ty::Opaque(..) => { - FfiUnsafe { ty, reason: fluent::lint::improper_ctypes_opaque, help: None } + FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_opaque, help: None } } // `extern "C" fn` functions can have type parameters, which may or may not be FFI-safe, @@ -1173,21 +1173,21 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { CItemKind::Definition => IMPROPER_CTYPES_DEFINITIONS, }; - self.cx.struct_span_lint(lint, sp, fluent::lint::improper_ctypes, |lint| { + self.cx.struct_span_lint(lint, sp, fluent::lint_improper_ctypes, |lint| { let item_description = match self.mode { CItemKind::Declaration => "block", CItemKind::Definition => "fn", }; lint.set_arg("ty", ty); lint.set_arg("desc", item_description); - lint.span_label(sp, fluent::lint::label); + lint.span_label(sp, fluent::label); if let Some(help) = help { lint.help(help); } lint.note(note); if let ty::Adt(def, _) = ty.kind() { if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did()) { - lint.span_note(sp, fluent::lint::note); + lint.span_note(sp, fluent::note); } } lint @@ -1224,7 +1224,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } if let Some(ty) = ty.visit_with(&mut ProhibitOpaqueTypes { cx: self.cx }).break_value() { - self.emit_ffi_unsafe_type_lint(ty, sp, fluent::lint::improper_ctypes_opaque, None); + self.emit_ffi_unsafe_type_lint(ty, sp, fluent::lint_improper_ctypes_opaque, None); true } else { false @@ -1269,7 +1269,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { self.emit_ffi_unsafe_type_lint( ty, sp, - fluent::lint::improper_ctypes_only_phantomdata, + fluent::lint_improper_ctypes_only_phantomdata, None, ); } @@ -1403,7 +1403,7 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences { cx.struct_span_lint( VARIANT_SIZE_DIFFERENCES, enum_definition.variants[largest_index].span, - fluent::lint::variant_size_differences, + fluent::lint_variant_size_differences, |lint| lint.set_arg("largest", largest), ); } @@ -1513,15 +1513,15 @@ impl InvalidAtomicOrdering { fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) { if let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::load, sym::store]) && let Some((ordering_arg, invalid_ordering, msg)) = match method { - sym::load => Some((&args[0], sym::Release, fluent::lint::atomic_ordering_load)), - sym::store => Some((&args[1], sym::Acquire, fluent::lint::atomic_ordering_store)), + sym::load => Some((&args[0], sym::Release, fluent::lint_atomic_ordering_load)), + sym::store => Some((&args[1], sym::Acquire, fluent::lint_atomic_ordering_store)), _ => None, } && let Some(ordering) = Self::match_ordering(cx, ordering_arg) && (ordering == invalid_ordering || ordering == sym::AcqRel) { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, msg, |lint| { - lint.help(fluent::lint::help) + lint.help(fluent::help) }); } } @@ -1533,9 +1533,9 @@ impl InvalidAtomicOrdering { && matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::fence | sym::compiler_fence)) && Self::match_ordering(cx, &args[0]) == Some(sym::Relaxed) { - cx.struct_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, fluent::lint::atomic_ordering_fence, |lint| { + cx.struct_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, fluent::lint_atomic_ordering_fence, |lint| { lint - .help(fluent::lint::help) + .help(fluent::help) }); } } @@ -1554,7 +1554,7 @@ impl InvalidAtomicOrdering { if matches!(fail_ordering, sym::Release | sym::AcqRel) { #[derive(LintDiagnostic)] - #[diag(lint::atomic_ordering_invalid)] + #[diag(lint_atomic_ordering_invalid)] #[help] struct InvalidAtomicOrderingDiag { method: Symbol, diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 36657909b19..46706e49844 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -155,12 +155,12 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { }; if let Some(must_use_op) = must_use_op { - cx.struct_span_lint(UNUSED_MUST_USE, expr.span, fluent::lint::unused_op, |lint| { + cx.struct_span_lint(UNUSED_MUST_USE, expr.span, fluent::lint_unused_op, |lint| { lint.set_arg("op", must_use_op) - .span_label(expr.span, fluent::lint::label) + .span_label(expr.span, fluent::label) .span_suggestion_verbose( expr.span.shrink_to_lo(), - fluent::lint::suggestion, + fluent::suggestion, "let _ = ", Applicability::MachineApplicable, ) @@ -169,7 +169,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { } if !(type_permits_lack_of_use || fn_warned || op_warned) { - cx.struct_span_lint(UNUSED_RESULTS, s.span, fluent::lint::unused_result, |lint| { + cx.struct_span_lint(UNUSED_RESULTS, s.span, fluent::lint_unused_result, |lint| { lint.set_arg("ty", ty) }); } @@ -272,14 +272,14 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { cx.struct_span_lint( UNUSED_MUST_USE, span, - fluent::lint::unused_closure, + fluent::lint_unused_closure, |lint| { // FIXME(davidtwco): this isn't properly translatable because of the // pre/post strings lint.set_arg("count", plural_len) .set_arg("pre", descr_pre) .set_arg("post", descr_post) - .note(fluent::lint::note) + .note(fluent::note) }, ); true @@ -288,14 +288,14 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { cx.struct_span_lint( UNUSED_MUST_USE, span, - fluent::lint::unused_generator, + fluent::lint_unused_generator, |lint| { // FIXME(davidtwco): this isn't properly translatable because of the // pre/post strings lint.set_arg("count", plural_len) .set_arg("pre", descr_pre) .set_arg("post", descr_post) - .note(fluent::lint::note) + .note(fluent::note) }, ); true @@ -317,7 +317,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults { descr_post_path: &str, ) -> bool { if let Some(attr) = cx.tcx.get_attr(def_id, sym::must_use) { - cx.struct_span_lint(UNUSED_MUST_USE, span, fluent::lint::unused_def, |lint| { + cx.struct_span_lint(UNUSED_MUST_USE, span, fluent::lint_unused_def, |lint| { // FIXME(davidtwco): this isn't properly translatable because of the pre/post // strings lint.set_arg("pre", descr_pre_path); @@ -369,17 +369,17 @@ impl<'tcx> LateLintPass<'tcx> for PathStatements { cx.struct_span_lint( PATH_STATEMENTS, s.span, - fluent::lint::path_statement_drop, + fluent::lint_path_statement_drop, |lint| { if let Ok(snippet) = cx.sess().source_map().span_to_snippet(expr.span) { lint.span_suggestion( s.span, - fluent::lint::suggestion, + fluent::suggestion, format!("drop({});", snippet), Applicability::MachineApplicable, ); } else { - lint.span_help(s.span, fluent::lint::suggestion); + lint.span_help(s.span, fluent::suggestion); } lint }, @@ -388,7 +388,7 @@ impl<'tcx> LateLintPass<'tcx> for PathStatements { cx.struct_span_lint( PATH_STATEMENTS, s.span, - fluent::lint::path_statement_no_effect, + fluent::lint_path_statement_no_effect, |lint| lint, ); } @@ -561,7 +561,7 @@ trait UnusedDelimLint { } else { MultiSpan::from(value_span) }; - cx.struct_span_lint(self.lint(), primary_span, fluent::lint::unused_delim, |lint| { + cx.struct_span_lint(self.lint(), primary_span, fluent::lint_unused_delim, |lint| { lint.set_arg("delim", Self::DELIM_STR); lint.set_arg("item", msg); if let Some((lo, hi)) = spans { @@ -570,7 +570,7 @@ trait UnusedDelimLint { (hi, if keep_space.1 { " ".into() } else { "".into() }), ]; lint.multipart_suggestion( - fluent::lint::suggestion, + fluent::suggestion, replacement, Applicability::MachineApplicable, ); @@ -1146,7 +1146,7 @@ impl UnusedImportBraces { cx.struct_span_lint( UNUSED_IMPORT_BRACES, item.span, - fluent::lint::unused_import_braces, + fluent::lint_unused_import_braces, |lint| lint.set_arg("node", node_name), ); } @@ -1201,9 +1201,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation { UNUSED_ALLOCATION, e.span, match m { - adjustment::AutoBorrowMutability::Not => fluent::lint::unused_allocation, + adjustment::AutoBorrowMutability::Not => fluent::lint_unused_allocation, adjustment::AutoBorrowMutability::Mut { .. } => { - fluent::lint::unused_allocation_mut + fluent::lint_unused_allocation_mut } }, |lint| lint, |
