2018-02-10 20:13:17 +00:00
|
|
|
#![warn(redundant_field_names)]
|
|
|
|
#![allow(unused_variables)]
|
2018-03-16 08:44:20 +00:00
|
|
|
#![feature(inclusive_range, inclusive_range_fields)]
|
2018-03-05 08:30:07 +00:00
|
|
|
|
2018-03-11 04:57:28 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate derive_new;
|
|
|
|
|
2018-03-05 08:30:07 +00:00
|
|
|
use std::ops::{Range, RangeFrom, RangeTo, RangeInclusive, RangeToInclusive};
|
2018-02-10 20:13:17 +00:00
|
|
|
|
|
|
|
mod foo {
|
|
|
|
pub const BAR: u8 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Person {
|
|
|
|
gender: u8,
|
|
|
|
age: u8,
|
2018-02-11 09:50:19 +00:00
|
|
|
name: u8,
|
2018-02-10 20:13:17 +00:00
|
|
|
buzz: u64,
|
|
|
|
foo: u8,
|
|
|
|
}
|
|
|
|
|
2018-03-11 04:57:28 +00:00
|
|
|
#[derive(new)]
|
|
|
|
pub struct S {
|
|
|
|
v: String,
|
|
|
|
}
|
|
|
|
|
2018-02-10 20:13:17 +00:00
|
|
|
fn main() {
|
|
|
|
let gender: u8 = 42;
|
|
|
|
let age = 0;
|
|
|
|
let fizz: u64 = 0;
|
2018-02-11 09:50:19 +00:00
|
|
|
let name: u8 = 0;
|
2018-02-10 20:13:17 +00:00
|
|
|
|
|
|
|
let me = Person {
|
|
|
|
gender: gender,
|
|
|
|
age: age,
|
|
|
|
|
2018-02-11 09:50:19 +00:00
|
|
|
name, //should be ok
|
2018-02-10 20:13:17 +00:00
|
|
|
buzz: fizz, //should be ok
|
|
|
|
foo: foo::BAR, //should be ok
|
|
|
|
};
|
2018-03-05 05:31:37 +00:00
|
|
|
|
2018-03-05 08:30:07 +00:00
|
|
|
// Range expressions
|
2018-03-05 05:31:37 +00:00
|
|
|
let (start, end) = (0, 0);
|
|
|
|
|
|
|
|
let _ = start..;
|
|
|
|
let _ = ..end;
|
|
|
|
let _ = start..end;
|
|
|
|
|
|
|
|
let _ = ..=end;
|
|
|
|
let _ = start..=end;
|
|
|
|
|
2018-03-05 08:30:07 +00:00
|
|
|
// hand-written Range family structs are linted
|
|
|
|
let _ = RangeFrom { start: start };
|
|
|
|
let _ = RangeTo { end: end };
|
|
|
|
let _ = Range { start: start, end: end };
|
|
|
|
let _ = RangeInclusive { start: start, end: end };
|
|
|
|
let _ = RangeToInclusive { end: end };
|
2018-02-10 20:13:17 +00:00
|
|
|
}
|