Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
merelymyself committed Oct 16, 2022
1 parent b0c6da1 commit e5fadf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tests/ui/paths_from_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/paths_from_format.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
|
Expand All @@ -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
|
Expand All @@ -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
|
Expand Down

0 comments on commit e5fadf8

Please sign in to comment.