]> git.lizzy.rs Git - rust.git/blob - tests/ui/print.rs
clean tests/ui/print.rs
[rust.git] / tests / ui / print.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3 #![deny(print_stdout, use_debug)]
4
5 use std::fmt::{Debug, Display, Formatter, Result};
6
7 #[allow(dead_code)]
8 struct Foo;
9
10 impl Display for Foo {
11     fn fmt(&self, f: &mut Formatter) -> Result {
12         write!(f, "{:?}", 43.1415)
13     }
14 }
15
16 impl Debug for Foo {
17     fn fmt(&self, f: &mut Formatter) -> Result {
18         // ok, we can use `Debug` formatting in `Debug` implementations
19         write!(f, "{:?}", 42.718)
20     }
21 }
22
23 fn main() {
24     println!("Hello");
25     print!("Hello");
26
27     print!("Hello {}", "World");
28
29     print!("Hello {:?}", "World");
30
31     print!("Hello {:#?}", "#orld");
32
33     assert_eq!(42, 1337);
34
35     vec![1, 2];
36 }