Auto-fix clippy::collapsible_if violations (#36428)
Release Notes: - N/A
This commit is contained in:
parent
9e8ec72bd5
commit
8f567383e4
281 changed files with 6628 additions and 7089 deletions
|
@ -185,11 +185,11 @@ impl Prettier {
|
|||
.metadata(&ignore_path)
|
||||
.await
|
||||
.with_context(|| format!("fetching metadata for {ignore_path:?}"))?
|
||||
&& !metadata.is_dir
|
||||
&& !metadata.is_symlink
|
||||
{
|
||||
if !metadata.is_dir && !metadata.is_symlink {
|
||||
log::info!("Found prettier ignore at {ignore_path:?}");
|
||||
return Ok(ControlFlow::Continue(Some(path_to_check)));
|
||||
}
|
||||
log::info!("Found prettier ignore at {ignore_path:?}");
|
||||
return Ok(ControlFlow::Continue(Some(path_to_check)));
|
||||
}
|
||||
match &closest_package_json_path {
|
||||
None => closest_package_json_path = Some(path_to_check.clone()),
|
||||
|
@ -223,13 +223,13 @@ impl Prettier {
|
|||
})
|
||||
{
|
||||
let workspace_ignore = path_to_check.join(".prettierignore");
|
||||
if let Some(metadata) = fs.metadata(&workspace_ignore).await? {
|
||||
if !metadata.is_dir {
|
||||
log::info!(
|
||||
"Found prettier ignore at workspace root {workspace_ignore:?}"
|
||||
);
|
||||
return Ok(ControlFlow::Continue(Some(path_to_check)));
|
||||
}
|
||||
if let Some(metadata) = fs.metadata(&workspace_ignore).await?
|
||||
&& !metadata.is_dir
|
||||
{
|
||||
log::info!(
|
||||
"Found prettier ignore at workspace root {workspace_ignore:?}"
|
||||
);
|
||||
return Ok(ControlFlow::Continue(Some(path_to_check)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -549,18 +549,16 @@ async fn read_package_json(
|
|||
.metadata(&possible_package_json)
|
||||
.await
|
||||
.with_context(|| format!("fetching metadata for package json {possible_package_json:?}"))?
|
||||
&& !package_json_metadata.is_dir
|
||||
&& !package_json_metadata.is_symlink
|
||||
{
|
||||
if !package_json_metadata.is_dir && !package_json_metadata.is_symlink {
|
||||
let package_json_contents = fs
|
||||
.load(&possible_package_json)
|
||||
.await
|
||||
.with_context(|| format!("reading {possible_package_json:?} file contents"))?;
|
||||
return serde_json::from_str::<HashMap<String, serde_json::Value>>(
|
||||
&package_json_contents,
|
||||
)
|
||||
let package_json_contents = fs
|
||||
.load(&possible_package_json)
|
||||
.await
|
||||
.with_context(|| format!("reading {possible_package_json:?} file contents"))?;
|
||||
return serde_json::from_str::<HashMap<String, serde_json::Value>>(&package_json_contents)
|
||||
.map(Some)
|
||||
.with_context(|| format!("parsing {possible_package_json:?} file contents"));
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue