|
5 | 5 | use eyre::{bail, Result}; |
6 | 6 | use temp_dir::TempDir; |
7 | 7 |
|
8 | | -use std::{ |
9 | | - env, |
10 | | - path::{Path, PathBuf}, |
11 | | - process::Stdio, |
12 | | - sync::LazyLock, |
13 | | -}; |
| 8 | +use std::{env, path::Path, process::Stdio, sync::LazyLock}; |
14 | 9 | use tokio::{fs, process::Command}; |
15 | 10 |
|
16 | 11 | use owo_colors::OwoColorize as _; |
@@ -78,8 +73,8 @@ async fn patch_user_file(f: &Path, userchrome: Option<&Userchrome>) -> Result<() |
78 | 73 | } |
79 | 74 |
|
80 | 75 | let mut ret_lines: Vec<String> = Vec::new(); |
81 | | - let start_idx = lines.iter().position(|k| k.eq(&START_LINE)); |
82 | | - let end_idx = lines.iter().position(|k| k.eq(&END_LINE)); |
| 76 | + let start_idx = lines.iter().position(|k| k == START_LINE); |
| 77 | + let end_idx = lines.iter().position(|k| k == END_LINE); |
83 | 78 |
|
84 | 79 | let mut ret_set = false; |
85 | 80 |
|
@@ -173,12 +168,12 @@ async fn handle_source(source: &str, target_dir: &Path) -> Result<()> { |
173 | 168 |
|
174 | 169 | utils::download_archive(&url, target_dir).await?; |
175 | 170 | } else if let Some(path) = source.strip_prefix("path:") { |
176 | | - let source = PathBuf::from(path); |
| 171 | + let source = Path::new(path); |
177 | 172 | if !source.is_dir() { |
178 | 173 | bail!("provided path {path:?} is not a directory"); |
179 | 174 | } |
180 | 175 |
|
181 | | - utils::copy_dir_all(&source, target_dir).await?; |
| 176 | + utils::copy_dir_all(source, target_dir).await?; |
182 | 177 | } else if let Some(url) = source.strip_prefix("url:") { |
183 | 178 | utils::download_archive(url, target_dir).await?; |
184 | 179 | } else if source.starts_with("https://") || source.starts_with("http://") { |
|
0 commit comments