]> git.lizzy.rs Git - rust.git/blob - tests/ui/print_with_newline.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / print_with_newline.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![allow(clippy::print_literal)]
11 #![warn(clippy::print_with_newline)]
12
13 fn main() {
14     print!("Hello\n");
15     print!("Hello {}\n", "world");
16     print!("Hello {} {}\n", "world", "#2");
17     print!("{}\n", 1265);
18
19     // these are all fine
20     print!("");
21     print!("Hello");
22     println!("Hello");
23     println!("Hello\n");
24     println!("Hello {}\n", "world");
25     print!("Issue\n{}", 1265);
26     print!("{}", 1265);
27     print!("\n{}", 1275);
28     print!("\n\n");
29     print!("like eof\n\n");
30     print!("Hello {} {}\n\n", "world", "#2");
31     println!("\ndon't\nwarn\nfor\nmultiple\nnewlines\n"); // #3126
32     println!("\nbla\n\n"); // #3126
33 }