2014-03-16 15:46:02 -05:00
|
|
|
// Tests to make sure that parens are needed for method calls without arguments.
|
|
|
|
// outputs text to make sure either an anonymous function is provided or
|
|
|
|
// open-close '()' parens are given
|
|
|
|
|
|
|
|
|
|
|
|
struct Point {
|
2015-01-08 04:54:35 -06:00
|
|
|
x: isize,
|
|
|
|
y: isize
|
2014-03-16 15:46:02 -05:00
|
|
|
}
|
|
|
|
impl Point {
|
|
|
|
fn new() -> Point {
|
|
|
|
Point{x:0, y:0}
|
|
|
|
}
|
2015-01-08 04:54:35 -06:00
|
|
|
fn get_x(&self) -> isize {
|
2014-03-16 15:46:02 -05:00
|
|
|
self.x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let point: Point = Point::new();
|
2015-01-08 04:54:35 -06:00
|
|
|
let px: isize = point
|
2014-06-13 16:56:42 -05:00
|
|
|
.get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
|
|
|
|
|
|
|
|
// Ensure the span is useful
|
2015-01-31 10:23:42 -06:00
|
|
|
let ys = &[1,2,3,4,5,6,7];
|
2014-06-13 16:56:42 -05:00
|
|
|
let a = ys.iter()
|
|
|
|
.map(|x| x)
|
|
|
|
.filter(|&&x| x == 1)
|
|
|
|
.filter_map; //~ ERROR attempted to take value of method `filter_map` on type
|
2014-03-16 15:46:02 -05:00
|
|
|
}
|