2015-01-10 00:26:58 -06:00
|
|
|
#![feature(plugin)]
|
2014-12-24 19:48:03 -06:00
|
|
|
|
2015-03-02 04:43:44 -06:00
|
|
|
#![plugin(clippy)]
|
2017-05-17 07:19:44 -05:00
|
|
|
#![warn(clippy)]
|
2015-04-13 12:58:18 -05:00
|
|
|
#![allow(unused)]
|
2014-12-24 19:48:03 -06:00
|
|
|
|
2017-02-08 07:58:07 -06:00
|
|
|
fn the_answer(ref mut x: u8) {
|
2014-12-24 19:48:03 -06:00
|
|
|
*x = 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = 0;
|
|
|
|
the_answer(x);
|
2015-08-16 06:54:03 -05:00
|
|
|
// Closures should not warn
|
|
|
|
let y = |ref x| { println!("{:?}", x) };
|
|
|
|
y(1u8);
|
2015-09-22 02:08:42 -05:00
|
|
|
|
2016-02-07 11:28:37 -06:00
|
|
|
let ref x = 1;
|
2017-02-08 07:58:07 -06:00
|
|
|
|
2016-06-29 15:37:10 -05:00
|
|
|
let ref y: (&_, u8) = (&1, 2);
|
2017-02-08 07:58:07 -06:00
|
|
|
|
2016-06-29 15:37:10 -05:00
|
|
|
let ref z = 1 + 2;
|
2017-02-08 07:58:07 -06:00
|
|
|
|
2016-07-15 07:22:34 -05:00
|
|
|
let ref mut z = 1 + 2;
|
2017-02-08 07:58:07 -06:00
|
|
|
|
2015-09-22 02:08:42 -05:00
|
|
|
let (ref x, _) = (1,2); // okay, not top level
|
2014-12-24 19:48:03 -06:00
|
|
|
println!("The answer is {}.", x);
|
|
|
|
}
|