diff options
Diffstat (limited to 'src/tools/clippy/src/docs/partial_pub_fields.txt')
-rw-r--r-- | src/tools/clippy/src/docs/partial_pub_fields.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/partial_pub_fields.txt b/src/tools/clippy/src/docs/partial_pub_fields.txt new file mode 100644 index 000000000..b529adf15 --- /dev/null +++ b/src/tools/clippy/src/docs/partial_pub_fields.txt @@ -0,0 +1,27 @@ +### What it does +Checks whether partial fields of a struct are public. + +Either make all fields of a type public, or make none of them public + +### Why is this bad? +Most types should either be: +* Abstract data types: complex objects with opaque implementation which guard +interior invariants and expose intentionally limited API to the outside world. +* Data: relatively simple objects which group a bunch of related attributes together. + +### Example +``` +pub struct Color { + pub r: u8, + pub g: u8, + b: u8, +} +``` +Use instead: +``` +pub struct Color { + pub r: u8, + pub g: u8, + pub b: u8, +} +```
\ No newline at end of file |