1
Fork 0

rustc_error: make ErrorReported impossible to construct

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
This commit is contained in:
mark 2022-01-22 18:49:12 -06:00
parent 461e807801
commit bb8d4307eb
104 changed files with 705 additions and 550 deletions

View file

@ -170,7 +170,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, |lint| {
lint.build(&format!("unused result of type `{}`", ty)).emit()
lint.build(&format!("unused result of type `{}`", ty)).emit();
});
}
@ -368,9 +368,9 @@ impl<'tcx> LateLintPass<'tcx> for PathStatements {
} else {
lint.span_help(s.span, "use `drop` to clarify the intent");
}
lint.emit()
lint.emit();
} else {
lint.build("path statement with no effect").emit()
lint.build("path statement with no effect").emit();
}
});
}
@ -1111,7 +1111,7 @@ impl UnusedImportBraces {
};
cx.struct_span_lint(UNUSED_IMPORT_BRACES, item.span, |lint| {
lint.build(&format!("braces around {} is unnecessary", node_name)).emit()
lint.build(&format!("braces around {} is unnecessary", node_name)).emit();
});
}
}
@ -1170,7 +1170,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation {
"unnecessary allocation, use `&mut` instead"
}
};
lint.build(msg).emit()
lint.build(msg).emit();
});
}
}