Apply suggestions from code review
commit suggestion of not always pretty printing Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
This commit is contained in:
parent
1696f534ab
commit
7951d19280
1 changed files with 8 additions and 8 deletions
|
@ -120,7 +120,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
|||
mixed_export_name_no_mangle_lint_state.track_no_mangle(
|
||||
attr.span,
|
||||
tcx.local_def_id_to_hir_id(did),
|
||||
rustc_ast_pretty::pprust::attribute_to_string(attr),
|
||||
attr,
|
||||
);
|
||||
} else {
|
||||
tcx.dcx()
|
||||
|
@ -788,22 +788,22 @@ fn check_link_name_xor_ordinal(
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct MixedExportNameAndNoMangleState {
|
||||
struct MixedExportNameAndNoMangleState<'a> {
|
||||
export_name: Option<Span>,
|
||||
hir_id: Option<HirId>,
|
||||
no_mangle: Option<Span>,
|
||||
no_mangle_attr_name: Option<String>,
|
||||
no_mangle_attr: Option<&'a ast::Attribute>,
|
||||
}
|
||||
|
||||
impl MixedExportNameAndNoMangleState {
|
||||
impl<'a> MixedExportNameAndNoMangleState<'a> {
|
||||
fn track_export_name(&mut self, span: Span) {
|
||||
self.export_name = Some(span);
|
||||
}
|
||||
|
||||
fn track_no_mangle(&mut self, span: Span, hir_id: HirId, attr_name: String) {
|
||||
fn track_no_mangle(&mut self, span: Span, hir_id: HirId, attr_name: &'a ast::Attribute) {
|
||||
self.no_mangle = Some(span);
|
||||
self.hir_id = Some(hir_id);
|
||||
self.no_mangle_attr_name = Some(attr_name);
|
||||
self.no_mangle_attr = Some(attr_name);
|
||||
}
|
||||
|
||||
/// Emit diagnostics if the lint condition is met.
|
||||
|
@ -812,7 +812,7 @@ impl MixedExportNameAndNoMangleState {
|
|||
export_name: Some(export_name),
|
||||
no_mangle: Some(no_mangle),
|
||||
hir_id: Some(hir_id),
|
||||
no_mangle_attr_name: Some(no_mangle_attr_name),
|
||||
no_mangle_attr: Some(no_mangle_attr),
|
||||
} = self
|
||||
{
|
||||
tcx.emit_node_span_lint(
|
||||
|
@ -821,7 +821,7 @@ impl MixedExportNameAndNoMangleState {
|
|||
no_mangle,
|
||||
errors::MixedExportNameAndNoMangle {
|
||||
no_mangle,
|
||||
no_mangle_attr: no_mangle_attr_name,
|
||||
no_mangle_attr: rustc_ast_pretty::pprust::attribute_to_string(no_mangle_attr),
|
||||
export_name,
|
||||
removal_span: no_mangle,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue