Skip to content

Commit

Permalink
Fixup clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Ana Hobden <operator@hoverbear.org>
  • Loading branch information
Hoverbear committed Jan 20, 2020
1 parent 8c6996c commit 8ddce03
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/lib.rs
Expand Up @@ -30,12 +30,10 @@ where
public: T,
}
fn main() {
let mut foo = Foo::default();
foo.set_private(1);
(*foo.private_mut()) += 1;
assert_eq!(*foo.private(), 2);
}
let mut foo = Foo::default();
foo.set_private(1);
(*foo.private_mut()) += 1;
assert_eq!(*foo.private(), 2);
```
You can use `cargo-expand` to generate the output. Here are the functions that the above generates (Replicate with `cargo expand --example simple`):
Expand Down Expand Up @@ -105,10 +103,8 @@ Attributes can be set on struct level for all fields in struct as well. Field le
precedence.
```rust
#[macro_use]
extern crate getset;
mod submodule {
use getset::{Getters, MutGetters, CopyGetters, Setters};
#[derive(Getters, CopyGetters, Default)]
#[get_copy = "pub"] // By default add a pub getting for all fields.
pub struct Foo {
Expand All @@ -131,19 +127,17 @@ For some purposes, it's useful to have the `get_` prefix on the getters for
either legacy of compatability reasons. It is done with `with_prefix`.
```rust
#[macro_use]
extern crate getset;
use getset::{Getters, MutGetters, CopyGetters, Setters};
#[derive(Getters, Default)]
pub struct Foo {
#[get = "pub with_prefix"]
field: bool,
}
fn main() {
let mut foo = Foo::default();
let val = foo.get_field();
}
let mut foo = Foo::default();
let val = foo.get_field();
```
*/

Expand Down

0 comments on commit 8ddce03

Please sign in to comment.