2022-10-16 08:02:23 +00:00
|
|
|
#![allow(unused)]
|
|
|
|
#![warn(clippy::partial_pub_fields)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct FileSet {
|
|
|
|
files: HashMap<String, u32>,
|
|
|
|
pub paths: HashMap<u32, String>,
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: mixed usage of pub and non-pub fields
|
2022-10-16 08:02:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Color {
|
|
|
|
pub r: u8,
|
|
|
|
pub g: u8,
|
|
|
|
b: u8,
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: mixed usage of pub and non-pub fields
|
2022-10-16 08:02:23 +00:00
|
|
|
}
|
2022-10-16 08:57:31 +00:00
|
|
|
|
|
|
|
pub struct Point(i32, pub i32);
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: mixed usage of pub and non-pub fields
|
2022-10-16 08:57:31 +00:00
|
|
|
|
|
|
|
pub struct Visibility {
|
|
|
|
r#pub: bool,
|
|
|
|
pub pos: u32,
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: mixed usage of pub and non-pub fields
|
2022-10-16 08:57:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Don't lint on empty structs;
|
|
|
|
pub struct Empty1;
|
|
|
|
pub struct Empty2();
|
|
|
|
pub struct Empty3 {};
|
|
|
|
|
|
|
|
// Don't lint on structs with one field.
|
|
|
|
pub struct Single1(i32);
|
|
|
|
pub struct Single2(pub i32);
|
|
|
|
pub struct Single3 {
|
|
|
|
v1: i32,
|
|
|
|
}
|
|
|
|
pub struct Single4 {
|
|
|
|
pub v1: i32,
|
|
|
|
}
|
2022-10-16 08:02:23 +00:00
|
|
|
}
|