diff --git a/README.md b/README.md index 91caaeba41a9..3d5e366f56db 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Lints included in this crate: - `clippy_box_vec`: Warns on usage of `Box>` - `clippy_dlist`: Warns on usage of `DList` - `clippy_str_to_string`: Warns on usage of `str::to_string()` + - `clippy_toplevel_ref_arg`: Warns when a function argument is declared `ref` (i.e. `fn foo(ref x: u8)`, but not `fn foo((ref x, ref y): (u8, u8))`). More to come, please [file an issue](https://github.com/Manishearth/rust-clippy/issues) if you have ideas! diff --git a/examples/toplevel_ref_arg.rs b/examples/toplevel_ref_arg.rs new file mode 100644 index 000000000000..0be737f90288 --- /dev/null +++ b/examples/toplevel_ref_arg.rs @@ -0,0 +1,14 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate rust_clippy; + +fn the_answer(ref mut x: u8) { + *x = 42; +} + +fn main() { + let mut x = 0; + the_answer(x); + println!("The answer is {}.", x); +}