forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.rs
More file actions
40 lines (34 loc) · 780 Bytes
/
main.rs
File metadata and controls
40 lines (34 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
struct S;
mod lib;
mod M1 {
pub mod M2 {
pub struct S;
impl S {
pub fn method(self) -> Self {
S
}
}
}
pub struct S2<T>(T);
impl<T> S2<T> {
pub fn new(x: T) -> Self {
S2(x)
}
}
}
fn main() {
let width = 4;
let precision = 2;
let value = 10;
println!("Value {value:#width$.precision$}", value = 10.5);
println!("Value {0:#1$.2$}", value, width, precision);
println!("Value {} {}", value, width);
let people = "Rustaceans";
println!("Hello {people}!");
println!("{1} {} {0} {}", 1, 2);
assert_eq!(format!("Hello {:<5}!", "x"), "Hello x !");
let x = S;
let s = M1::M2::S;
s.method();
M1::S2::<S>::new(S);
}