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