Use ui_test's Windows path backslash heuristic

This commit is contained in:
Alex Macleod 2023-08-14 15:59:00 +00:00
parent b5bfd1176b
commit 77d10ac63d
21 changed files with 237 additions and 260 deletions

View file

@ -4,12 +4,10 @@
#![warn(rust_2018_idioms, unused_lifetimes)] #![warn(rust_2018_idioms, unused_lifetimes)]
#![allow(unused_extern_crates)] #![allow(unused_extern_crates)]
use compiletest::{status_emitter, Args, CommandBuilder, OutputConflictHandling}; use ui_test::{status_emitter, Args, CommandBuilder, Config, Match, Mode, OutputConflictHandling};
use ui_test as compiletest;
use ui_test::Mode as TestMode;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::env::{self, remove_var, set_var, var_os}; use std::env::{self, set_var, var_os};
use std::ffi::{OsStr, OsString}; use std::ffi::{OsStr, OsString};
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -29,6 +27,8 @@ extern crate quote;
extern crate syn; extern crate syn;
extern crate tokio; extern crate tokio;
mod test_utils;
/// All crates used in UI tests are listed here /// All crates used in UI tests are listed here
static TEST_DEPENDENCIES: &[&str] = &[ static TEST_DEPENDENCIES: &[&str] = &[
"clippy_lints", "clippy_lints",
@ -104,8 +104,6 @@ static EXTERN_FLAGS: LazyLock<Vec<String>> = LazyLock::new(|| {
.collect() .collect()
}); });
mod test_utils;
// whether to run internal tests or not // whether to run internal tests or not
const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal"); const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal");
@ -115,7 +113,7 @@ fn canonicalize(path: impl AsRef<Path>) -> PathBuf {
fs::canonicalize(path).unwrap_or_else(|err| panic!("{} cannot be canonicalized: {err}", path.display())) fs::canonicalize(path).unwrap_or_else(|err| panic!("{} cannot be canonicalized: {err}", path.display()))
} }
fn base_config(test_dir: &str) -> (compiletest::Config, Args) { fn base_config(test_dir: &str) -> (Config, Args) {
let bless = var_os("RUSTC_BLESS").is_some_and(|v| v != "0") || env::args().any(|arg| arg == "--bless"); let bless = var_os("RUSTC_BLESS").is_some_and(|v| v != "0") || env::args().any(|arg| arg == "--bless");
let args = Args { let args = Args {
@ -131,9 +129,9 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
skip: Vec::new(), skip: Vec::new(),
}; };
let mut config = compiletest::Config { let mut config = Config {
mode: TestMode::Yolo { rustfix: true }, mode: Mode::Yolo { rustfix: true },
stderr_filters: vec![], stderr_filters: vec![(Match::PathBackslash, b"/")],
stdout_filters: vec![], stdout_filters: vec![],
output_conflict_handling: if bless { output_conflict_handling: if bless {
OutputConflictHandling::Bless OutputConflictHandling::Bless
@ -141,8 +139,8 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
OutputConflictHandling::Error("cargo uibless".into()) OutputConflictHandling::Error("cargo uibless".into())
}, },
target: None, target: None,
out_dir: canonicalize(std::env::var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into())).join("ui_test"), out_dir: canonicalize(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into())).join("ui_test"),
..compiletest::Config::rustc(Path::new("tests").join(test_dir)) ..Config::rustc(Path::new("tests").join(test_dir))
}; };
let current_exe_path = env::current_exe().unwrap(); let current_exe_path = env::current_exe().unwrap();
let deps_path = current_exe_path.parent().unwrap(); let deps_path = current_exe_path.parent().unwrap();
@ -167,10 +165,6 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
config.program.args.push(dep.into()); config.program.args.push(dep.into());
} }
// Normalize away slashes in windows paths.
config.stderr_filter(r"\\", "/");
//config.build_base = profile_path.join("test").join(test_dir);
config.program.program = profile_path.join(if cfg!(windows) { config.program.program = profile_path.join(if cfg!(windows) {
"clippy-driver.exe" "clippy-driver.exe"
} else { } else {
@ -180,18 +174,19 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
} }
fn run_ui() { fn run_ui() {
let (config, args) = base_config("ui"); let (mut config, args) = base_config("ui");
// use tests/clippy.toml config
let _g = VarGuard::set("CARGO_MANIFEST_DIR", canonicalize("tests")); .program
let _threads = VarGuard::set("RUST_TEST_THREADS", args.threads.to_string()); .envs
.push(("CLIPPY_CONF_DIR".into(), Some(canonicalize("tests").into())));
let quiet = args.quiet; let quiet = args.quiet;
compiletest::run_tests_generic( ui_test::run_tests_generic(
vec![config], vec![config],
args, args,
compiletest::default_file_filter, ui_test::default_file_filter,
compiletest::default_per_file_config, ui_test::default_per_file_config,
if quiet { if quiet {
status_emitter::Text::quiet() status_emitter::Text::quiet()
} else { } else {
@ -212,11 +207,11 @@ fn run_internal_tests() {
} }
let quiet = args.quiet; let quiet = args.quiet;
compiletest::run_tests_generic( ui_test::run_tests_generic(
vec![config], vec![config],
args, args,
compiletest::default_file_filter, ui_test::default_file_filter,
compiletest::default_per_file_config, ui_test::default_per_file_config,
if quiet { if quiet {
status_emitter::Text::quiet() status_emitter::Text::quiet()
} else { } else {
@ -229,24 +224,27 @@ fn run_internal_tests() {
fn run_ui_toml() { fn run_ui_toml() {
let (mut config, args) = base_config("ui-toml"); let (mut config, args) = base_config("ui-toml");
config.stderr_filter( config.stderr_filters = vec![
&regex::escape( (
&canonicalize("tests") Match::Exact(
canonicalize("tests")
.parent() .parent()
.unwrap() .unwrap()
.display() .to_string_lossy()
.to_string() .as_bytes()
.replace('\\', "/"), .to_vec(),
), ),
"$$DIR", b"$DIR",
); ),
(Match::Exact(b"\\".to_vec()), b"/"),
];
let quiet = args.quiet; let quiet = args.quiet;
ui_test::run_tests_generic( ui_test::run_tests_generic(
vec![config], vec![config],
args, args,
compiletest::default_file_filter, ui_test::default_file_filter,
|config, path, _file_contents| { |config, path, _file_contents| {
config config
.program .program
@ -285,17 +283,20 @@ fn run_ui_cargo() {
}); });
config.edition = None; config.edition = None;
config.stderr_filter( config.stderr_filters = vec![
&regex::escape( (
&canonicalize("tests") Match::Exact(
canonicalize("tests")
.parent() .parent()
.unwrap() .unwrap()
.display() .to_string_lossy()
.to_string() .as_bytes()
.replace('\\', "/"), .to_vec(),
), ),
"$$DIR", b"$DIR",
); ),
(Match::Exact(b"\\".to_vec()), b"/"),
];
let quiet = args.quiet; let quiet = args.quiet;
@ -410,27 +411,3 @@ fn ui_cargo_toml_metadata() {
); );
} }
} }
/// Restores an env var on drop
#[must_use]
struct VarGuard {
key: &'static str,
value: Option<OsString>,
}
impl VarGuard {
fn set(key: &'static str, val: impl AsRef<OsStr>) -> Self {
let value = var_os(key);
set_var(key, val);
Self { key, value }
}
}
impl Drop for VarGuard {
fn drop(&mut self) {
match self.value.as_deref() {
None => remove_var(self.key),
Some(value) => set_var(self.key, value),
}
}
}

View file

@ -10,24 +10,24 @@ LL | let _ = 'a' as u8;
error: casting a character literal to `u8` truncates error: casting a character literal to `u8` truncates
--> $DIR/char_lit_as_u8_suggestions.rs:5:13 --> $DIR/char_lit_as_u8_suggestions.rs:5:13
| |
LL | let _ = '/n' as u8; LL | let _ = '\n' as u8;
| ^^^^^^^^^^ help: use a byte literal instead: `b'/n'` | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'`
| |
= note: `char` is four bytes wide, but `u8` is a single byte = note: `char` is four bytes wide, but `u8` is a single byte
error: casting a character literal to `u8` truncates error: casting a character literal to `u8` truncates
--> $DIR/char_lit_as_u8_suggestions.rs:6:13 --> $DIR/char_lit_as_u8_suggestions.rs:6:13
| |
LL | let _ = '/0' as u8; LL | let _ = '\0' as u8;
| ^^^^^^^^^^ help: use a byte literal instead: `b'/0'` | ^^^^^^^^^^ help: use a byte literal instead: `b'\0'`
| |
= note: `char` is four bytes wide, but `u8` is a single byte = note: `char` is four bytes wide, but `u8` is a single byte
error: casting a character literal to `u8` truncates error: casting a character literal to `u8` truncates
--> $DIR/char_lit_as_u8_suggestions.rs:7:13 --> $DIR/char_lit_as_u8_suggestions.rs:7:13
| |
LL | let _ = '/x01' as u8; LL | let _ = '\x01' as u8;
| ^^^^^^^^^^^^ help: use a byte literal instead: `b'/x01'` | ^^^^^^^^^^^^ help: use a byte literal instead: `b'\x01'`
| |
= note: `char` is four bytes wide, but `u8` is a single byte = note: `char` is four bytes wide, but `u8` is a single byte

View file

@ -1,7 +1,7 @@
warning: multiple lines skipped by escaped newline warning: multiple lines skipped by escaped newline
--> $DIR/ice-9405.rs:6:10 --> $DIR/ice-9405.rs:6:10
| |
LL | "/ LL | "\
| __________^ | __________^
LL | | LL | |
LL | | {}", LL | | {}",

View file

@ -24,12 +24,12 @@ LL | /// The foo_bar function does _nothing_. See also `foo::bar`. (note the dot
error: item in documentation is missing backticks error: item in documentation is missing backticks
--> $DIR/doc-fixable.rs:10:83 --> $DIR/doc-fixable.rs:10:83
| |
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not Foo::some_fun LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
help: try help: try
| |
LL | /// Markdown is _weird_. I mean _really weird_. This /_ is ok. So is `_`. But not `Foo::some_fun` LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not `Foo::some_fun`
| ~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~
error: item in documentation is missing backticks error: item in documentation is missing backticks

View file

@ -1,74 +1,74 @@
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:5:5 --> $DIR/eprint_with_newline.rs:5:5
| |
LL | eprint!("Hello/n"); LL | eprint!("Hello\n");
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::print-with-newline` implied by `-D warnings` = note: `-D clippy::print-with-newline` implied by `-D warnings`
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("Hello/n"); LL - eprint!("Hello\n");
LL + eprintln!("Hello"); LL + eprintln!("Hello");
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:6:5 --> $DIR/eprint_with_newline.rs:6:5
| |
LL | eprint!("Hello {}/n", "world"); LL | eprint!("Hello {}\n", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("Hello {}/n", "world"); LL - eprint!("Hello {}\n", "world");
LL + eprintln!("Hello {}", "world"); LL + eprintln!("Hello {}", "world");
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:7:5 --> $DIR/eprint_with_newline.rs:7:5
| |
LL | eprint!("Hello {} {}/n", "world", "#2"); LL | eprint!("Hello {} {}\n", "world", "#2");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("Hello {} {}/n", "world", "#2"); LL - eprint!("Hello {} {}\n", "world", "#2");
LL + eprintln!("Hello {} {}", "world", "#2"); LL + eprintln!("Hello {} {}", "world", "#2");
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:8:5 --> $DIR/eprint_with_newline.rs:8:5
| |
LL | eprint!("{}/n", 1265); LL | eprint!("{}\n", 1265);
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("{}/n", 1265); LL - eprint!("{}\n", 1265);
LL + eprintln!("{}", 1265); LL + eprintln!("{}", 1265);
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:9:5 --> $DIR/eprint_with_newline.rs:9:5
| |
LL | eprint!("/n"); LL | eprint!("\n");
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("/n"); LL - eprint!("\n");
LL + eprintln!(); LL + eprintln!();
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:28:5 --> $DIR/eprint_with_newline.rs:28:5
| |
LL | eprint!("///n"); // should fail LL | eprint!("\\\n"); // should fail
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("///n"); // should fail LL - eprint!("\\\n"); // should fail
LL + eprintln!("//"); // should fail LL + eprintln!("\\"); // should fail
| |
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
@ -104,13 +104,13 @@ LL ~
error: using `eprint!()` with a format string that ends in a single newline error: using `eprint!()` with a format string that ends in a single newline
--> $DIR/eprint_with_newline.rs:47:5 --> $DIR/eprint_with_newline.rs:47:5
| |
LL | eprint!("//r/n"); LL | eprint!("\\r\n");
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
help: use `eprintln!` instead help: use `eprintln!` instead
| |
LL - eprint!("//r/n"); LL - eprint!("\\r\n");
LL + eprintln!("//r"); LL + eprintln!("\\r");
| |
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View file

@ -39,14 +39,14 @@ LL | std::io::stderr().write_fmt(format_args!("test")).unwrap();
error: use of `writeln!(stdout(), ...).unwrap()` error: use of `writeln!(stdout(), ...).unwrap()`
--> $DIR/explicit_write.rs:31:9 --> $DIR/explicit_write.rs:31:9
| |
LL | writeln!(std::io::stdout(), "test/ntest").unwrap(); LL | writeln!(std::io::stdout(), "test\ntest").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `println!("test/ntest")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `println!("test\ntest")`
error: use of `writeln!(stderr(), ...).unwrap()` error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:32:9 --> $DIR/explicit_write.rs:32:9
| |
LL | writeln!(std::io::stderr(), "test/ntest").unwrap(); LL | writeln!(std::io::stderr(), "test\ntest").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("test/ntest")` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `eprintln!("test\ntest")`
error: use of `writeln!(stderr(), ...).unwrap()` error: use of `writeln!(stderr(), ...).unwrap()`
--> $DIR/explicit_write.rs:35:9 --> $DIR/explicit_write.rs:35:9

View file

@ -72,8 +72,8 @@ LL | let _ = Some(format!("{}", a + "bar"));
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:78:22 --> $DIR/format.rs:78:22
| |
LL | let _s: String = format!("{}", &*v.join("/n")); LL | let _s: String = format!("{}", &*v.join("\n"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("/n")).to_string()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("\n")).to_string()`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:84:13 --> $DIR/format.rs:84:13

View file

@ -15,14 +15,14 @@ LL | let _: String = std::iter::repeat('x').take(10).collect();
error: manual implementation of `str::repeat` using iterators error: manual implementation of `str::repeat` using iterators
--> $DIR/manual_str_repeat.rs:9:21 --> $DIR/manual_str_repeat.rs:9:21
| |
LL | let _: String = std::iter::repeat('/'').take(10).collect(); LL | let _: String = std::iter::repeat('\'').take(10).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"'".repeat(10)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"'".repeat(10)`
error: manual implementation of `str::repeat` using iterators error: manual implementation of `str::repeat` using iterators
--> $DIR/manual_str_repeat.rs:10:21 --> $DIR/manual_str_repeat.rs:10:21
| |
LL | let _: String = std::iter::repeat('"').take(10).collect(); LL | let _: String = std::iter::repeat('"').take(10).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"/"".repeat(10)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"\"".repeat(10)`
error: manual implementation of `str::repeat` using iterators error: manual implementation of `str::repeat` using iterators
--> $DIR/manual_str_repeat.rs:14:13 --> $DIR/manual_str_repeat.rs:14:13

View file

@ -1,146 +1,146 @@
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:5:17 --> $DIR/octal_escapes.rs:5:17
| |
LL | let _bad1 = "/033[0m"; LL | let _bad1 = "\033[0m";
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
= note: `-D clippy::octal-escapes` implied by `-D warnings` = note: `-D clippy::octal-escapes` implied by `-D warnings`
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad1 = "/x1b[0m"; LL | let _bad1 = "\x1b[0m";
| ~~~~~~~~~ | ~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad1 = "/x0033[0m"; LL | let _bad1 = "\x0033[0m";
| ~~~~~~~~~~~ | ~~~~~~~~~~~
error: octal-looking escape in byte string literal error: octal-looking escape in byte string literal
--> $DIR/octal_escapes.rs:6:17 --> $DIR/octal_escapes.rs:6:17
| |
LL | let _bad2 = b"/033[0m"; LL | let _bad2 = b"\033[0m";
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null byte = help: octal escapes are not supported, `\0` is always a null byte
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad2 = b"/x1b[0m"; LL | let _bad2 = b"\x1b[0m";
| ~~~~~~~~~~ | ~~~~~~~~~~
help: if the null byte is intended, disambiguate using help: if the null byte is intended, disambiguate using
| |
LL | let _bad2 = b"/x0033[0m"; LL | let _bad2 = b"\x0033[0m";
| ~~~~~~~~~~~~ | ~~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:7:17 --> $DIR/octal_escapes.rs:7:17
| |
LL | let _bad3 = "///033[0m"; LL | let _bad3 = "\\\033[0m";
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad3 = "///x1b[0m"; LL | let _bad3 = "\\\x1b[0m";
| ~~~~~~~~~~~ | ~~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad3 = "///x0033[0m"; LL | let _bad3 = "\\\x0033[0m";
| ~~~~~~~~~~~~~ | ~~~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:9:17 --> $DIR/octal_escapes.rs:9:17
| |
LL | let _bad4 = "/01234567"; LL | let _bad4 = "\01234567";
| ^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad4 = "/x0a34567"; LL | let _bad4 = "\x0a34567";
| ~~~~~~~~~~~ | ~~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad4 = "/x001234567"; LL | let _bad4 = "\x001234567";
| ~~~~~~~~~~~~~ | ~~~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:10:17 --> $DIR/octal_escapes.rs:10:17
| |
LL | let _bad5 = "/0/03"; LL | let _bad5 = "\0\03";
| ^^^^^^^ | ^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad5 = "/0/x03"; LL | let _bad5 = "\0\x03";
| ~~~~~~~~ | ~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad5 = "/0/x003"; LL | let _bad5 = "\0\x003";
| ~~~~~~~~~ | ~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:11:17 --> $DIR/octal_escapes.rs:11:17
| |
LL | let _bad6 = "Text-/055/077-MoreText"; LL | let _bad6 = "Text-\055\077-MoreText";
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad6 = "Text-/x2d/x3f-MoreText"; LL | let _bad6 = "Text-\x2d\x3f-MoreText";
| ~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad6 = "Text-/x0055/x0077-MoreText"; LL | let _bad6 = "Text-\x0055\x0077-MoreText";
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:12:17 --> $DIR/octal_escapes.rs:12:17
| |
LL | let _bad7 = "EvenMoreText-/01/02-ShortEscapes"; LL | let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad7 = "EvenMoreText-/x01/x02-ShortEscapes"; LL | let _bad7 = "EvenMoreText-\x01\x02-ShortEscapes";
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad7 = "EvenMoreText-/x001/x002-ShortEscapes"; LL | let _bad7 = "EvenMoreText-\x001\x002-ShortEscapes";
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:13:17 --> $DIR/octal_escapes.rs:13:17
| |
LL | let _bad8 = "锈/01锈"; LL | let _bad8 = "锈\01锈";
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad8 = "锈/x01锈"; LL | let _bad8 = "锈\x01锈";
| ~~~~~~~~~~ | ~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad8 = "锈/x001锈"; LL | let _bad8 = "锈\x001锈";
| ~~~~~~~~~~~ | ~~~~~~~~~~~
error: octal-looking escape in string literal error: octal-looking escape in string literal
--> $DIR/octal_escapes.rs:14:17 --> $DIR/octal_escapes.rs:14:17
| |
LL | let _bad9 = "锈/011锈"; LL | let _bad9 = "锈\011锈";
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
= help: octal escapes are not supported, `/0` is always a null character = help: octal escapes are not supported, `\0` is always a null character
help: if an octal escape was intended, use the hexadecimal representation instead help: if an octal escape was intended, use the hexadecimal representation instead
| |
LL | let _bad9 = "锈/x09锈"; LL | let _bad9 = "锈\x09锈";
| ~~~~~~~~~~ | ~~~~~~~~~~
help: if the null character is intended, disambiguate using help: if the null character is intended, disambiguate using
| |
LL | let _bad9 = "锈/x0011锈"; LL | let _bad9 = "锈\x0011锈";
| ~~~~~~~~~~~~ | ~~~~~~~~~~~~
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View file

@ -1,4 +1,4 @@
error: calling `push` with '/' or '/' (file system root) will overwrite the previous path definition error: calling `push` with '/' or '\' (file system root) will overwrite the previous path definition
--> $DIR/path_buf_push_overwrite.rs:6:12 --> $DIR/path_buf_push_overwrite.rs:6:12
| |
LL | x.push("/bar"); LL | x.push("/bar");

View file

@ -1,74 +1,74 @@
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:7:5 --> $DIR/print_with_newline.rs:7:5
| |
LL | print!("Hello/n"); LL | print!("Hello\n");
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::print-with-newline` implied by `-D warnings` = note: `-D clippy::print-with-newline` implied by `-D warnings`
help: use `println!` instead help: use `println!` instead
| |
LL - print!("Hello/n"); LL - print!("Hello\n");
LL + println!("Hello"); LL + println!("Hello");
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:8:5 --> $DIR/print_with_newline.rs:8:5
| |
LL | print!("Hello {}/n", "world"); LL | print!("Hello {}\n", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("Hello {}/n", "world"); LL - print!("Hello {}\n", "world");
LL + println!("Hello {}", "world"); LL + println!("Hello {}", "world");
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:9:5 --> $DIR/print_with_newline.rs:9:5
| |
LL | print!("Hello {} {}/n", "world", "#2"); LL | print!("Hello {} {}\n", "world", "#2");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("Hello {} {}/n", "world", "#2"); LL - print!("Hello {} {}\n", "world", "#2");
LL + println!("Hello {} {}", "world", "#2"); LL + println!("Hello {} {}", "world", "#2");
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:10:5 --> $DIR/print_with_newline.rs:10:5
| |
LL | print!("{}/n", 1265); LL | print!("{}\n", 1265);
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("{}/n", 1265); LL - print!("{}\n", 1265);
LL + println!("{}", 1265); LL + println!("{}", 1265);
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:11:5 --> $DIR/print_with_newline.rs:11:5
| |
LL | print!("/n"); LL | print!("\n");
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("/n"); LL - print!("\n");
LL + println!(); LL + println!();
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:30:5 --> $DIR/print_with_newline.rs:30:5
| |
LL | print!("///n"); // should fail LL | print!("\\\n"); // should fail
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("///n"); // should fail LL - print!("\\\n"); // should fail
LL + println!("//"); // should fail LL + println!("\\"); // should fail
| |
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
@ -104,13 +104,13 @@ LL ~
error: using `print!()` with a format string that ends in a single newline error: using `print!()` with a format string that ends in a single newline
--> $DIR/print_with_newline.rs:49:5 --> $DIR/print_with_newline.rs:49:5
| |
LL | print!("//r/n"); // should fail LL | print!("\\r\n"); // should fail
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
help: use `println!` instead help: use `println!` instead
| |
LL - print!("//r/n"); // should fail LL - print!("\\r\n"); // should fail
LL + println!("//r"); // should fail LL + println!("\\r"); // should fail
| |
error: aborting due to 9 previous errors error: aborting due to 9 previous errors

View file

@ -70,7 +70,7 @@ error: regex parse error:
error: unclosed group error: unclosed group
--> $DIR/regex.rs:39:37 --> $DIR/regex.rs:39:37
| |
LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+/.(com|org|net)"]); LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: regex parse error: error: regex parse error:
@ -79,16 +79,16 @@ error: regex parse error:
error: unclosed group error: unclosed group
--> $DIR/regex.rs:40:39 --> $DIR/regex.rs:40:39
| |
LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+/.(com|org|net)"]); LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: regex parse error: error: regex parse error:
/b/c \b\c
^^ ^^
error: unrecognized escape sequence error: unrecognized escape sequence
--> $DIR/regex.rs:47:42 --> $DIR/regex.rs:47:42
| |
LL | let escaped_string_span = Regex::new("//b//c"); LL | let escaped_string_span = Regex::new("\\b\\c");
| ^^^^^^^^ | ^^^^^^^^
| |
= help: consider using a raw string literal: `r".."` = help: consider using a raw string literal: `r".."`
@ -156,7 +156,7 @@ LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
error: trivial regex error: trivial regex
--> $DIR/regex.rs:70:40 --> $DIR/regex.rs:70:40
| |
LL | let trivial_backslash = Regex::new("a//.b"); LL | let trivial_backslash = Regex::new("a\\.b");
| ^^^^^^^ | ^^^^^^^
| |
= help: consider using `str::contains` = help: consider using `str::contains`

View file

@ -10,19 +10,19 @@ error: calling `push_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:15:5 --> $DIR/single_char_add_str.rs:15:5
| |
LL | string.push_str("'"); LL | string.push_str("'");
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('/'')` | ^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\'')`
error: calling `push_str()` using a single-character string literal error: calling `push_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:20:5 --> $DIR/single_char_add_str.rs:20:5
| |
LL | string.push_str("/x52"); LL | string.push_str("\x52");
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('/x52')` | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\x52')`
error: calling `push_str()` using a single-character string literal error: calling `push_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:21:5 --> $DIR/single_char_add_str.rs:21:5
| |
LL | string.push_str("/u{0052}"); LL | string.push_str("\u{0052}");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('/u{0052}')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `string.push('\u{0052}')`
error: calling `push_str()` using a single-character string literal error: calling `push_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:22:5 --> $DIR/single_char_add_str.rs:22:5
@ -46,19 +46,19 @@ error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:30:5 --> $DIR/single_char_add_str.rs:30:5
| |
LL | string.insert_str(1, "'"); LL | string.insert_str(1, "'");
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(1, '/'')` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(1, '\'')`
error: calling `insert_str()` using a single-character string literal error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:35:5 --> $DIR/single_char_add_str.rs:35:5
| |
LL | string.insert_str(0, "/x52"); LL | string.insert_str(0, "\x52");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '/x52')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\x52')`
error: calling `insert_str()` using a single-character string literal error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:36:5 --> $DIR/single_char_add_str.rs:36:5
| |
LL | string.insert_str(0, "/u{0052}"); LL | string.insert_str(0, "\u{0052}");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '/u{0052}')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(0, '\u{0052}')`
error: calling `insert_str()` using a single-character string literal error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:38:5 --> $DIR/single_char_add_str.rs:38:5
@ -82,7 +82,7 @@ error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:42:5 --> $DIR/single_char_add_str.rs:42:5
| |
LL | string.insert_str(Y, r##"'"##); LL | string.insert_str(Y, r##"'"##);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '/'')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `insert` with a character literal: `string.insert(Y, '\'')`
error: calling `insert_str()` using a single-character string literal error: calling `insert_str()` using a single-character string literal
--> $DIR/single_char_add_str.rs:44:5 --> $DIR/single_char_add_str.rs:44:5

View file

@ -165,20 +165,20 @@ LL | x.replacen("x", "y", 3);
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:42:13 --> $DIR/single_char_pattern.rs:42:13
| |
LL | x.split("/n"); LL | x.split("\n");
| ^^^^ help: try using a `char` instead: `'/n'` | ^^^^ help: try using a `char` instead: `'\n'`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:43:13 --> $DIR/single_char_pattern.rs:43:13
| |
LL | x.split("'"); LL | x.split("'");
| ^^^ help: try using a `char` instead: `'/''` | ^^^ help: try using a `char` instead: `'\''`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:44:13 --> $DIR/single_char_pattern.rs:44:13
| |
LL | x.split("/'"); LL | x.split("\'");
| ^^^^ help: try using a `char` instead: `'/''` | ^^^^ help: try using a `char` instead: `'\''`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:49:31 --> $DIR/single_char_pattern.rs:49:31
@ -189,8 +189,8 @@ LL | x.replace(';', ",").split(","); // issue #2978
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:50:19 --> $DIR/single_char_pattern.rs:50:19
| |
LL | x.starts_with("/x03"); // issue #2996 LL | x.starts_with("\x03"); // issue #2996
| ^^^^^^ help: try using a `char` instead: `'/x03'` | ^^^^^^ help: try using a `char` instead: `'\x03'`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:57:13 --> $DIR/single_char_pattern.rs:57:13
@ -214,7 +214,7 @@ error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:60:13 --> $DIR/single_char_pattern.rs:60:13
| |
LL | x.split(r###"'"###); LL | x.split(r###"'"###);
| ^^^^^^^^^^ help: try using a `char` instead: `'/''` | ^^^^^^^^^^ help: try using a `char` instead: `'\''`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:61:13 --> $DIR/single_char_pattern.rs:61:13
@ -225,14 +225,14 @@ LL | x.split(r###"#"###);
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:63:13 --> $DIR/single_char_pattern.rs:63:13
| |
LL | x.split(r#"/"#); LL | x.split(r#"\"#);
| ^^^^^^ help: try using a `char` instead: `'//'` | ^^^^^^ help: try using a `char` instead: `'\\'`
error: single-character string constant used as pattern error: single-character string constant used as pattern
--> $DIR/single_char_pattern.rs:64:13 --> $DIR/single_char_pattern.rs:64:13
| |
LL | x.split(r"/"); LL | x.split(r"\");
| ^^^^ help: try using a `char` instead: `'//'` | ^^^^ help: try using a `char` instead: `'\\'`
error: aborting due to 39 previous errors error: aborting due to 39 previous errors

View file

@ -15,14 +15,14 @@ LL | Some(' ') != "".chars().next();
error: you should use the `starts_with` method error: you should use the `starts_with` method
--> $DIR/starts_ends_with.rs:11:5 --> $DIR/starts_ends_with.rs:11:5
| |
LL | "".chars().next() == Some('/n'); LL | "".chars().next() == Some('\n');
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with('/n')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".starts_with('\n')`
error: you should use the `starts_with` method error: you should use the `starts_with` method
--> $DIR/starts_ends_with.rs:12:5 --> $DIR/starts_ends_with.rs:12:5
| |
LL | Some('/n') != "".chars().next(); LL | Some('\n') != "".chars().next();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with('/n')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".starts_with('\n')`
error: you should use the `starts_with` method error: you should use the `starts_with` method
--> $DIR/starts_ends_with.rs:17:8 --> $DIR/starts_ends_with.rs:17:8
@ -59,8 +59,8 @@ LL | if s.chars().next_back().unwrap() != 'o' {
error: you should use the `ends_with` method error: you should use the `ends_with` method
--> $DIR/starts_ends_with.rs:37:8 --> $DIR/starts_ends_with.rs:37:8
| |
LL | if s.chars().last().unwrap() != '/n' { LL | if s.chars().last().unwrap() != '\n' {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('/n')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!s.ends_with('\n')`
error: you should use the `ends_with` method error: you should use the `ends_with` method
--> $DIR/starts_ends_with.rs:45:5 --> $DIR/starts_ends_with.rs:45:5
@ -89,14 +89,14 @@ LL | Some(' ') != "".chars().next_back();
error: you should use the `ends_with` method error: you should use the `ends_with` method
--> $DIR/starts_ends_with.rs:51:5 --> $DIR/starts_ends_with.rs:51:5
| |
LL | "".chars().last() == Some('/n'); LL | "".chars().last() == Some('\n');
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with('/n')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `"".ends_with('\n')`
error: you should use the `ends_with` method error: you should use the `ends_with` method
--> $DIR/starts_ends_with.rs:52:5 --> $DIR/starts_ends_with.rs:52:5
| |
LL | Some('/n') != "".chars().last(); LL | Some('\n') != "".chars().last();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with('/n')` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `!"".ends_with('\n')`
error: aborting due to 16 previous errors error: aborting due to 16 previous errors

View file

@ -44,8 +44,8 @@ LL | let includestr = include_str!("string_lit_as_bytes.rs").as_bytes();
error: calling `as_bytes()` on a string literal error: calling `as_bytes()` on a string literal
--> $DIR/string_lit_as_bytes.rs:40:13 --> $DIR/string_lit_as_bytes.rs:40:13
| |
LL | let _ = "string with newline/t/n".as_bytes(); LL | let _ = "string with newline\t\n".as_bytes();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline/t/n"` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `b"string with newline\t\n"`
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -1,57 +1,57 @@
error: usage of `.chars().any(...)` to check if a char matches any from a string literal error: usage of `.chars().any(...)` to check if a char matches any from a string literal
--> $DIR/string_lit_chars_any.rs:18:5 --> $DIR/string_lit_chars_any.rs:18:5
| |
LL | "//.+*?()|[]{}^$#&-~".chars().any(|x| x == c); LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::string-lit-chars-any` implied by `-D warnings` = note: `-D clippy::string-lit-chars-any` implied by `-D warnings`
help: use `matches!(...)` instead help: use `matches!(...)` instead
| |
LL | matches!(c, '//' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'); LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: usage of `.chars().any(...)` to check if a char matches any from a string literal error: usage of `.chars().any(...)` to check if a char matches any from a string literal
--> $DIR/string_lit_chars_any.rs:19:5 --> $DIR/string_lit_chars_any.rs:19:5
| |
LL | r#"/.+*?()|[]{}^$#&-~"#.chars().any(|x| x == c); LL | r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| x == c);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `matches!(...)` instead help: use `matches!(...)` instead
| |
LL | matches!(c, '//' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'); LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: usage of `.chars().any(...)` to check if a char matches any from a string literal error: usage of `.chars().any(...)` to check if a char matches any from a string literal
--> $DIR/string_lit_chars_any.rs:20:5 --> $DIR/string_lit_chars_any.rs:20:5
| |
LL | "//.+*?()|[]{}^$#&-~".chars().any(|x| c == x); LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| c == x);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `matches!(...)` instead help: use `matches!(...)` instead
| |
LL | matches!(c, '//' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'); LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: usage of `.chars().any(...)` to check if a char matches any from a string literal error: usage of `.chars().any(...)` to check if a char matches any from a string literal
--> $DIR/string_lit_chars_any.rs:21:5 --> $DIR/string_lit_chars_any.rs:21:5
| |
LL | r#"/.+*?()|[]{}^$#&-~"#.chars().any(|x| c == x); LL | r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| c == x);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `matches!(...)` instead help: use `matches!(...)` instead
| |
LL | matches!(c, '//' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'); LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: usage of `.chars().any(...)` to check if a char matches any from a string literal error: usage of `.chars().any(...)` to check if a char matches any from a string literal
--> $DIR/string_lit_chars_any.rs:23:5 --> $DIR/string_lit_chars_any.rs:23:5
| |
LL | "//.+*?()|[]{}^$#&-~".chars().any(|x| { x == c }); LL | "\\.+*?()|[]{}^$#&-~".chars().any(|x| { x == c });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `matches!(...)` instead help: use `matches!(...)` instead
| |
LL | matches!(c, '//' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~'); LL | matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -2,7 +2,7 @@ error: invisible character detected
--> $DIR/unicode.rs:5:12 --> $DIR/unicode.rs:5:12
| |
LL | print!("Here >< is a ZWS, and another"); LL | print!("Here >< is a ZWS, and another");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >/u{200B}< is a ZWS, and /u{200B}another"` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{200B}< is a ZWS, and \u{200B}another"`
| |
= note: `-D clippy::invisible-characters` implied by `-D warnings` = note: `-D clippy::invisible-characters` implied by `-D warnings`
@ -10,13 +10,13 @@ error: invisible character detected
--> $DIR/unicode.rs:7:12 --> $DIR/unicode.rs:7:12
| |
LL | print!("Here >­< is a SHY, and ­another"); LL | print!("Here >­< is a SHY, and ­another");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >/u{AD}< is a SHY, and /u{AD}another"` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{AD}< is a SHY, and \u{AD}another"`
error: invisible character detected error: invisible character detected
--> $DIR/unicode.rs:9:12 --> $DIR/unicode.rs:9:12
| |
LL | print!("Here >< is a WJ, and another"); LL | print!("Here >< is a WJ, and another");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >/u{2060}< is a WJ, and /u{2060}another"` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >\u{2060}< is a WJ, and \u{2060}another"`
error: non-NFC Unicode sequence detected error: non-NFC Unicode sequence detected
--> $DIR/unicode.rs:15:12 --> $DIR/unicode.rs:15:12
@ -30,7 +30,7 @@ error: literal non-ASCII character detected
--> $DIR/unicode.rs:23:16 --> $DIR/unicode.rs:23:16
| |
LL | print!("Üben!"); LL | print!("Üben!");
| ^^^^^^^ help: consider replacing the string with: `"/u{dc}ben!"` | ^^^^^^^ help: consider replacing the string with: `"\u{dc}ben!"`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unicode.rs:20:13 --> $DIR/unicode.rs:20:13
@ -42,19 +42,19 @@ error: literal non-ASCII character detected
--> $DIR/unicode.rs:29:36 --> $DIR/unicode.rs:29:36
| |
LL | const _EMPTY_BLOCK: char = '▱'; LL | const _EMPTY_BLOCK: char = '▱';
| ^^^ help: consider replacing the string with: `'/u{25b1}'` | ^^^ help: consider replacing the string with: `'\u{25b1}'`
error: literal non-ASCII character detected error: literal non-ASCII character detected
--> $DIR/unicode.rs:30:35 --> $DIR/unicode.rs:30:35
| |
LL | const _FULL_BLOCK: char = '▰'; LL | const _FULL_BLOCK: char = '▰';
| ^^^ help: consider replacing the string with: `'/u{25b0}'` | ^^^ help: consider replacing the string with: `'\u{25b0}'`
error: literal non-ASCII character detected error: literal non-ASCII character detected
--> $DIR/unicode.rs:50:21 --> $DIR/unicode.rs:50:21
| |
LL | let _ = "悲しいかな、ここに日本語を書くことはできない。"; LL | let _ = "悲しいかな、ここに日本語を書くことはできない。";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"/u{60b2}/u{3057}/u{3044}/u{304b}/u{306a}/u{3001}/u{3053}/u{3053}/u{306b}/u{65e5}/u{672c}/u{8a9e}/u{3092}/u{66f8}/u{304f}/u{3053}/u{3068}/u{306f}/u{3067}/u{304d}/u{306a}/u{3044}/u{3002}"` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"\u{60b2}\u{3057}\u{3044}\u{304b}\u{306a}\u{3001}\u{3053}\u{3053}\u{306b}\u{65e5}\u{672c}\u{8a9e}\u{3092}\u{66f8}\u{304f}\u{3053}\u{3068}\u{306f}\u{3067}\u{304d}\u{306a}\u{3044}\u{3002}"`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unicode.rs:39:17 --> $DIR/unicode.rs:39:17

View file

@ -216,24 +216,24 @@ LL + println!("{val}");
error: variables can be used directly in the `format!` string error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:72:5 --> $DIR/uninlined_format_args.rs:72:5
| |
LL | println!("val='{/t }'", local_i32); LL | println!("val='{\t }'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: change this to help: change this to
| |
LL - println!("val='{/t }'", local_i32); LL - println!("val='{\t }'", local_i32);
LL + println!("val='{local_i32}'"); LL + println!("val='{local_i32}'");
| |
error: variables can be used directly in the `format!` string error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:73:5 --> $DIR/uninlined_format_args.rs:73:5
| |
LL | println!("val='{/n }'", local_i32); LL | println!("val='{\n }'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: change this to help: change this to
| |
LL - println!("val='{/n }'", local_i32); LL - println!("val='{\n }'", local_i32);
LL + println!("val='{local_i32}'"); LL + println!("val='{local_i32}'");
| |

View file

@ -34,12 +34,12 @@ LL + writeln!(v, r"{{hello}}");
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:12:23 --> $DIR/write_literal_2.rs:12:23
| |
LL | writeln!(v, "{}", '/''); LL | writeln!(v, "{}", '\'');
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, "{}", '/''); LL - writeln!(v, "{}", '\'');
LL + writeln!(v, "'"); LL + writeln!(v, "'");
| |
@ -52,7 +52,7 @@ LL | writeln!(v, "{}", '"');
help: try help: try
| |
LL - writeln!(v, "{}", '"'); LL - writeln!(v, "{}", '"');
LL + writeln!(v, "/""); LL + writeln!(v, "\"");
| |
error: literal with an empty format string error: literal with an empty format string
@ -64,25 +64,25 @@ LL | writeln!(v, r"{}", '"');
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:15:24 --> $DIR/write_literal_2.rs:15:24
| |
LL | writeln!(v, r"{}", '/''); LL | writeln!(v, r"{}", '\'');
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, r"{}", '/''); LL - writeln!(v, r"{}", '\'');
LL + writeln!(v, r"'"); LL + writeln!(v, r"'");
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:19:9 --> $DIR/write_literal_2.rs:19:9
| |
LL | / "hello / LL | / "hello \
LL | | world!" LL | | world!"
| |_______________^ | |_______________^
| |
help: try help: try
| |
LL ~ "some hello / LL ~ "some hello \
LL ~ world!" LL ~ world!"
| |
@ -94,8 +94,8 @@ LL | "1", "2", "3",
| |
help: try help: try
| |
LL ~ "some 1/ LL ~ "some 1\
LL ~ {} // {}", "2", "3", LL ~ {} \\ {}", "2", "3",
| |
error: literal with an empty format string error: literal with an empty format string
@ -106,7 +106,7 @@ LL | "1", "2", "3",
| |
help: try help: try
| |
LL ~ 2 // {}", LL ~ 2 \\ {}",
LL ~ "1", "3", LL ~ "1", "3",
| |
@ -118,68 +118,68 @@ LL | "1", "2", "3",
| |
help: try help: try
| |
LL ~ {} // 3", LL ~ {} \\ 3",
LL ~ "1", "2", LL ~ "1", "2",
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:28:23 --> $DIR/write_literal_2.rs:28:23
| |
LL | writeln!(v, "{}", "//"); LL | writeln!(v, "{}", "\\");
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, "{}", "//"); LL - writeln!(v, "{}", "\\");
LL + writeln!(v, "//"); LL + writeln!(v, "\\");
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:29:24 --> $DIR/write_literal_2.rs:29:24
| |
LL | writeln!(v, r"{}", "//"); LL | writeln!(v, r"{}", "\\");
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, r"{}", "//"); LL - writeln!(v, r"{}", "\\");
LL + writeln!(v, r"/"); LL + writeln!(v, r"\");
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:30:26 --> $DIR/write_literal_2.rs:30:26
| |
LL | writeln!(v, r#"{}"#, "//"); LL | writeln!(v, r#"{}"#, "\\");
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, r#"{}"#, "//"); LL - writeln!(v, r#"{}"#, "\\");
LL + writeln!(v, r#"/"#); LL + writeln!(v, r#"\"#);
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:31:23 --> $DIR/write_literal_2.rs:31:23
| |
LL | writeln!(v, "{}", r"/"); LL | writeln!(v, "{}", r"\");
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, "{}", r"/"); LL - writeln!(v, "{}", r"\");
LL + writeln!(v, "//"); LL + writeln!(v, "\\");
| |
error: literal with an empty format string error: literal with an empty format string
--> $DIR/write_literal_2.rs:32:23 --> $DIR/write_literal_2.rs:32:23
| |
LL | writeln!(v, "{}", "/r"); LL | writeln!(v, "{}", "\r");
| ^^^^ | ^^^^
| |
help: try help: try
| |
LL - writeln!(v, "{}", "/r"); LL - writeln!(v, "{}", "\r");
LL + writeln!(v, "/r"); LL + writeln!(v, "\r");
| |
error: literal with an empty format string error: literal with an empty format string

View file

@ -1,74 +1,74 @@
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:12:5 --> $DIR/write_with_newline.rs:12:5
| |
LL | write!(v, "Hello/n"); LL | write!(v, "Hello\n");
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::write-with-newline` implied by `-D warnings` = note: `-D clippy::write-with-newline` implied by `-D warnings`
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "Hello/n"); LL - write!(v, "Hello\n");
LL + writeln!(v, "Hello"); LL + writeln!(v, "Hello");
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:13:5 --> $DIR/write_with_newline.rs:13:5
| |
LL | write!(v, "Hello {}/n", "world"); LL | write!(v, "Hello {}\n", "world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "Hello {}/n", "world"); LL - write!(v, "Hello {}\n", "world");
LL + writeln!(v, "Hello {}", "world"); LL + writeln!(v, "Hello {}", "world");
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:14:5 --> $DIR/write_with_newline.rs:14:5
| |
LL | write!(v, "Hello {} {}/n", "world", "#2"); LL | write!(v, "Hello {} {}\n", "world", "#2");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "Hello {} {}/n", "world", "#2"); LL - write!(v, "Hello {} {}\n", "world", "#2");
LL + writeln!(v, "Hello {} {}", "world", "#2"); LL + writeln!(v, "Hello {} {}", "world", "#2");
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:15:5 --> $DIR/write_with_newline.rs:15:5
| |
LL | write!(v, "{}/n", 1265); LL | write!(v, "{}\n", 1265);
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "{}/n", 1265); LL - write!(v, "{}\n", 1265);
LL + writeln!(v, "{}", 1265); LL + writeln!(v, "{}", 1265);
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:16:5 --> $DIR/write_with_newline.rs:16:5
| |
LL | write!(v, "/n"); LL | write!(v, "\n");
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "/n"); LL - write!(v, "\n");
LL + writeln!(v); LL + writeln!(v);
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:35:5 --> $DIR/write_with_newline.rs:35:5
| |
LL | write!(v, "///n"); // should fail LL | write!(v, "\\\n"); // should fail
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "///n"); // should fail LL - write!(v, "\\\n"); // should fail
LL + writeln!(v, "//"); // should fail LL + writeln!(v, "\\"); // should fail
| |
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
@ -106,13 +106,13 @@ LL ~ v
error: using `write!()` with a format string that ends in a single newline error: using `write!()` with a format string that ends in a single newline
--> $DIR/write_with_newline.rs:56:5 --> $DIR/write_with_newline.rs:56:5
| |
LL | write!(v, "//r/n"); LL | write!(v, "\\r\n");
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
help: use `writeln!` instead help: use `writeln!` instead
| |
LL - write!(v, "//r/n"); LL - write!(v, "\\r\n");
LL + writeln!(v, "//r"); LL + writeln!(v, "\\r");
| |
error: aborting due to 9 previous errors error: aborting due to 9 previous errors