From e5fadf83a02ac9dace54b7aad3fd04ecdfab68c3 Mon Sep 17 00:00:00 2001 From: merelymyself Date: Sun, 16 Oct 2022 22:38:56 +0800 Subject: [PATCH] fix tests --- tests/ui/paths_from_format.rs | 8 ++++---- tests/ui/paths_from_format.stderr | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/ui/paths_from_format.rs b/tests/ui/paths_from_format.rs index 88c6e7a15c06..718d63c64c08 100644 --- a/tests/ui/paths_from_format.rs +++ b/tests/ui/paths_from_format.rs @@ -5,10 +5,10 @@ use std::path::PathBuf; fn main() { let mut base_path1 = ""; let mut base_path2 = ""; - PathBuf::from(format!("{}/foo/bar", base_path1)); - PathBuf::from(format!("/foo/bar/{}", base_path1)); - PathBuf::from(format!("/foo/{}/bar", base_path1)); - PathBuf::from(format!("foo/{}/bar", base_path1)); + PathBuf::from(format!("{base_path1}/foo/bar")); + PathBuf::from(format!("/foo/bar/{base_path1}")); + PathBuf::from(format!("/foo/{base_path1}/bar")); + PathBuf::from(format!("foo/{base_path1}/bar")); PathBuf::from(format!("foo/foooo/{base_path1}/bar/barrr")); PathBuf::from(format!("foo/foooo/{base_path1}/bar/barrr/{base_path2}")); PathBuf::from(format!("{base_path2}/foo/{base_path1}/bar")); diff --git a/tests/ui/paths_from_format.stderr b/tests/ui/paths_from_format.stderr index 08ad91f723c2..2754d87b435b 100644 --- a/tests/ui/paths_from_format.stderr +++ b/tests/ui/paths_from_format.stderr @@ -1,8 +1,8 @@ error: `format!(..)` used to form `PathBuf` --> $DIR/paths_from_format.rs:8:5 | -LL | PathBuf::from(format!("{}/foo/bar", base_path1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | PathBuf::from(format!("{base_path1}/foo/bar")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::paths-from-format` implied by `-D warnings` help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability @@ -13,8 +13,8 @@ LL | Path::new(&base_path1).join("foo").join("bar"); error: `format!(..)` used to form `PathBuf` --> $DIR/paths_from_format.rs:9:5 | -LL | PathBuf::from(format!("/foo/bar/{}", base_path1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | PathBuf::from(format!("/foo/bar/{base_path1}")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability | @@ -24,8 +24,8 @@ LL | Path::new("/").join("foo").join("bar").join(&base_path1); error: `format!(..)` used to form `PathBuf` --> $DIR/paths_from_format.rs:10:5 | -LL | PathBuf::from(format!("/foo/{}/bar", base_path1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | PathBuf::from(format!("/foo/{base_path1}/bar")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability | @@ -35,8 +35,8 @@ LL | Path::new("/").join("foo").join(&base_path1).join("bar"); error: `format!(..)` used to form `PathBuf` --> $DIR/paths_from_format.rs:11:5 | -LL | PathBuf::from(format!("foo/{}/bar", base_path1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | PathBuf::from(format!("foo/{base_path1}/bar")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability |