mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
20 lines
391 B
Rust
20 lines
391 B
Rust
//@ run-rustfix
|
|
struct Rectangle {
|
|
width: i32,
|
|
height: i32,
|
|
}
|
|
impl Rectangle {
|
|
fn new(width: i32, height: i32) -> Self {
|
|
Self { width, height }
|
|
}
|
|
fn area(&self) -> i32 {
|
|
self.height * self.width
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let rect = Rectangle::new(3, 4);
|
|
let _ = rect.area();
|
|
//~^ ERROR failed to resolve: use of undeclared crate or module `rect`
|
|
}
|