rust/tests/ui/parser/expr-rarrow-call.rs

34 lines
671 B
Rust

//@ run-rustfix
#![allow(
dead_code,
unused_must_use
)]
struct Named {
foo: usize
}
struct Unnamed(usize);
fn named_struct_field_access(named: &Named) {
named->foo; //~ ERROR `->` used for field access or method call
}
fn unnamed_struct_field_access(unnamed: &Unnamed) {
unnamed->0; //~ ERROR `->` used for field access or method call
}
fn tuple_field_access(t: &(u8, u8)) {
t->0; //~ ERROR `->` used for field access or method call
t->1; //~ ERROR `->` used for field access or method call
}
#[derive(Clone)]
struct Foo;
fn method_call(foo: &Foo) {
foo->clone(); //~ ERROR `->` used for field access or method call
}
fn main() {}