Skip to content

Commit e5fadf8

Browse files
committed
fix tests
1 parent b0c6da1 commit e5fadf8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/ui/paths_from_format.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use std::path::PathBuf;
55
fn main() {
66
let mut base_path1 = "";
77
let mut base_path2 = "";
8-
PathBuf::from(format!("{}/foo/bar", base_path1));
9-
PathBuf::from(format!("/foo/bar/{}", base_path1));
10-
PathBuf::from(format!("/foo/{}/bar", base_path1));
11-
PathBuf::from(format!("foo/{}/bar", base_path1));
8+
PathBuf::from(format!("{base_path1}/foo/bar"));
9+
PathBuf::from(format!("/foo/bar/{base_path1}"));
10+
PathBuf::from(format!("/foo/{base_path1}/bar"));
11+
PathBuf::from(format!("foo/{base_path1}/bar"));
1212
PathBuf::from(format!("foo/foooo/{base_path1}/bar/barrr"));
1313
PathBuf::from(format!("foo/foooo/{base_path1}/bar/barrr/{base_path2}"));
1414
PathBuf::from(format!("{base_path2}/foo/{base_path1}/bar"));

tests/ui/paths_from_format.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: `format!(..)` used to form `PathBuf`
22
--> $DIR/paths_from_format.rs:8:5
33
|
4-
LL | PathBuf::from(format!("{}/foo/bar", base_path1));
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | PathBuf::from(format!("{base_path1}/foo/bar"));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::paths-from-format` implied by `-D warnings`
88
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");
1313
error: `format!(..)` used to form `PathBuf`
1414
--> $DIR/paths_from_format.rs:9:5
1515
|
16-
LL | PathBuf::from(format!("/foo/bar/{}", base_path1));
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
LL | PathBuf::from(format!("/foo/bar/{base_path1}"));
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
|
1919
help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability
2020
|
@@ -24,8 +24,8 @@ LL | Path::new("/").join("foo").join("bar").join(&base_path1);
2424
error: `format!(..)` used to form `PathBuf`
2525
--> $DIR/paths_from_format.rs:10:5
2626
|
27-
LL | PathBuf::from(format!("/foo/{}/bar", base_path1));
28-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
LL | PathBuf::from(format!("/foo/{base_path1}/bar"));
28+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2929
|
3030
help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability
3131
|
@@ -35,8 +35,8 @@ LL | Path::new("/").join("foo").join(&base_path1).join("bar");
3535
error: `format!(..)` used to form `PathBuf`
3636
--> $DIR/paths_from_format.rs:11:5
3737
|
38-
LL | PathBuf::from(format!("foo/{}/bar", base_path1));
39-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
LL | PathBuf::from(format!("foo/{base_path1}/bar"));
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4040
|
4141
help: consider using `Path::new()` and `.join()` to make it OS-agnostic and improve code readability
4242
|

0 commit comments

Comments
 (0)