2015-10-15 04:13:01 -05:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#![deny(clippy)]
|
|
|
|
|
|
|
|
fn test_as_slice() {
|
|
|
|
let v = vec![1];
|
|
|
|
v.as_slice(); //~ERROR used as_slice() from the 'convert' nightly feature. Use &[..]
|
|
|
|
|
|
|
|
let mut v2 = vec![1];
|
|
|
|
v2.as_mut_slice(); //~ERROR used as_mut_slice() from the 'convert' nightly feature. Use &mut [..]
|
|
|
|
}
|
|
|
|
|
2015-10-17 13:16:54 -05:00
|
|
|
struct ShouldWork;
|
|
|
|
|
|
|
|
impl ShouldWork {
|
|
|
|
fn as_slice(&self) -> &ShouldWork { self }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_should_work() {
|
|
|
|
let sw = ShouldWork;
|
|
|
|
sw.as_slice();
|
|
|
|
}
|
|
|
|
|
2015-10-15 04:13:01 -05:00
|
|
|
fn main() {
|
|
|
|
test_as_slice();
|
2015-10-17 13:16:54 -05:00
|
|
|
test_should_work();
|
2015-10-15 04:13:01 -05:00
|
|
|
}
|