void visit (HIR::Function &function) override
{
HirId hirId = function.get_mappings ().get_hirid ();
- if (should_warn (hirId))
+ if (should_warn (hirId) && !function.get_visibility ().is_public ())
{
if (mappings->is_impl_item (hirId))
{
void visit (HIR::StructStruct &stct) override
{
HirId hirId = stct.get_mappings ().get_hirid ();
- if (should_warn (hirId))
+ if (should_warn (hirId) && !stct.get_visibility ().is_public ())
{
bool name_starts_underscore = stct.get_identifier ().at (0) == '_';
if (!name_starts_underscore)
for (auto &field : stct.get_fields ())
{
HirId field_hir_id = field.get_mappings ().get_hirid ();
- if (should_warn (field_hir_id))
+ if (should_warn (field_hir_id)
+ && !field.get_visibility ().is_public ())
{
rust_warning_at (field.get_locus (), 0,
"field is never read: %<%s%>",
{
// only warn tuple struct unconstructed, and ignoring unused field
HirId hirId = stct.get_mappings ().get_hirid ();
- if (should_warn (hirId))
+ if (should_warn (hirId) && !stct.get_visibility ().is_public ())
{
rust_warning_at (stct.get_locus (), 0,
"struct is never constructed: %<%s%>",
#[lang = "const_ptr"]
impl<T> *const T {
pub const unsafe fn offset(self, count: isize) -> *const T {
- // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { offset(self, count) }
}
pub const unsafe fn add(self, count: usize) -> Self {
- // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { self.offset(count as isize) }
}
}
#[lang = "const_ptr"]
impl<T> *const T {
pub const unsafe fn offset(self, count: isize) -> *mut T {
- // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { intrinsics::offset(self, count) as *mut T }
}
pub const unsafe fn add(self, count: usize) -> Self {
- // { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
unsafe { self.offset(count as isize) }
}
}