vfs: Fix warnings about clippy str_to_string rule

This commit is contained in:
Tetsuharu Ohzeki 2024-02-10 00:52:46 +09:00
parent 81c35d1f56
commit cee3c22ae8
2 changed files with 8 additions and 8 deletions

View file

@ -201,7 +201,7 @@ impl Directories {
/// ```
fn dirs(base: AbsPathBuf, exclude: &[&str]) -> Directories {
let exclude = exclude.iter().map(|it| base.join(it)).collect::<Vec<_>>();
Directories { extensions: vec!["rs".to_string()], include: vec![base], exclude }
Directories { extensions: vec!["rs".to_owned()], include: vec![base], exclude }
}
impl fmt::Debug for Message {

View file

@ -2,29 +2,29 @@ use super::*;
#[test]
fn virtual_path_extensions() {
assert_eq!(VirtualPath("/".to_string()).name_and_extension(), None);
assert_eq!(VirtualPath("/".to_owned()).name_and_extension(), None);
assert_eq!(
VirtualPath("/directory".to_string()).name_and_extension(),
VirtualPath("/directory".to_owned()).name_and_extension(),
Some(("directory", None))
);
assert_eq!(
VirtualPath("/directory/".to_string()).name_and_extension(),
VirtualPath("/directory/".to_owned()).name_and_extension(),
Some(("directory", None))
);
assert_eq!(
VirtualPath("/directory/file".to_string()).name_and_extension(),
VirtualPath("/directory/file".to_owned()).name_and_extension(),
Some(("file", None))
);
assert_eq!(
VirtualPath("/directory/.file".to_string()).name_and_extension(),
VirtualPath("/directory/.file".to_owned()).name_and_extension(),
Some((".file", None))
);
assert_eq!(
VirtualPath("/directory/.file.rs".to_string()).name_and_extension(),
VirtualPath("/directory/.file.rs".to_owned()).name_and_extension(),
Some((".file", Some("rs")))
);
assert_eq!(
VirtualPath("/directory/file.rs".to_string()).name_and_extension(),
VirtualPath("/directory/file.rs".to_owned()).name_and_extension(),
Some(("file", Some("rs")))
);
}