Replace object_safety_violations().is_empty() calls with is_object_safe

This commit is contained in:
Gary Guo 2022-12-29 09:52:46 +00:00
parent d8da513668
commit e144a13254
3 changed files with 3 additions and 5 deletions

View file

@ -834,7 +834,7 @@ fn check_object_unsafe_self_trait_by_name(tcx: TyCtxt<'_>, item: &hir::TraitItem
_ => {}
}
if !trait_should_be_self.is_empty() {
if tcx.object_safety_violations(trait_def_id).is_empty() {
if tcx.is_object_safe(trait_def_id) {
return;
}
let sugg = trait_should_be_self.iter().map(|span| (*span, "Self".to_string())).collect();