]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/print.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / print.rs
CommitLineData
abe05a73
XL
1
2
ea8adc8c
XL
3#![warn(print_stdout, use_debug)]
4
5use std::fmt::{Debug, Display, Formatter, Result};
6
7#[allow(dead_code)]
8struct Foo;
9
10impl Display for Foo {
11 fn fmt(&self, f: &mut Formatter) -> Result {
12 write!(f, "{:?}", 43.1415)
13 }
14}
15
16impl 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
23fn 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}