mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-25 17:23:39 +01:00
9159341714
This changes how the files are named (to allow for snapshots that aren't directly related to the --style argument) and fixes the generate_snapshots.py script to work with the latest version of bat. Three new tests are also introduced: - tabs_4 - Tab expansion with a width of 4. - tabs_8 - Tab expansion with a width of 8. - tabs_passthrough - No tab expansion.
32 lines
462 B
Rust
32 lines
462 B
Rust
struct Rectangle {
|
|
width: u32,
|
|
height: u32,
|
|
}
|
|
|
|
fn main() {
|
|
// width and height of a rectangle can be different
|
|
let rect1 = Rectangle { width: 30, height: 50 };
|
|
|
|
println!(
|
|
"The area of the rectangle is {} square pixels.",
|
|
area(&rect1)
|
|
);
|
|
}
|
|
|
|
fn area(rectangle: &Rectangle) -> u32 {
|
|
rectangle.width * rectangle.height
|
|
}
|
|
|
|
// Tab alignment:
|
|
/*
|
|
Indent
|
|
1 2 3 4
|
|
1 ?
|
|
22 ?
|
|
333 ?
|
|
4444 ?
|
|
55555 ?
|
|
666666 ?
|
|
7777777 ?
|
|
88888888 ?
|
|
*/ |