Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 861 Bytes

edition-2018.rst

File metadata and controls

51 lines (33 loc) · 861 Bytes

Rust Edition 2018 - Productivity

如果變數名稱跟 struct 欄位一樣的話可以簡化:

struct Point {
    x: i32,
    y: i32,
}

let x = 5;
let y = 6;

// old
let p = Point {
    x: x,
    y: y,
};

// new
let p = Point {
    x,
    y,
};
rustup target add x86_64-unknown-linux-musl
cargo build --target x86_64-unknown-linux-musl