Auto-fix clippy::collapsible_if violations (#36428)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 15:27:24 +02:00 committed by GitHub
parent 9e8ec72bd5
commit 8f567383e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
281 changed files with 6628 additions and 7089 deletions

View file

@ -13,13 +13,13 @@ where
while let Some(entry) = entries.next().await {
if let Some(entry) = entry.log_err() {
let entry_path = entry.path();
if predicate(entry_path.as_path()) {
if let Ok(metadata) = fs::metadata(&entry_path).await {
if metadata.is_file() {
fs::remove_file(&entry_path).await.log_err();
} else {
fs::remove_dir_all(&entry_path).await.log_err();
}
if predicate(entry_path.as_path())
&& let Ok(metadata) = fs::metadata(&entry_path).await
{
if metadata.is_file() {
fs::remove_file(&entry_path).await.log_err();
} else {
fs::remove_dir_all(&entry_path).await.log_err();
}
}
}
@ -35,10 +35,10 @@ where
if let Some(mut entries) = fs::read_dir(dir).await.log_err() {
while let Some(entry) = entries.next().await {
if let Some(entry) = entry.log_err() {
if predicate(entry.path().as_path()) {
matching.push(entry.path());
}
if let Some(entry) = entry.log_err()
&& predicate(entry.path().as_path())
{
matching.push(entry.path());
}
}
}
@ -58,10 +58,9 @@ where
if let Some(file_name) = entry_path
.file_name()
.map(|file_name| file_name.to_string_lossy())
&& predicate(&file_name)
{
if predicate(&file_name) {
return Some(entry_path);
}
return Some(entry_path);
}
}
}

View file

@ -44,13 +44,12 @@ pub struct DefaultDenyUnknownFields;
impl schemars::transform::Transform for DefaultDenyUnknownFields {
fn transform(&mut self, schema: &mut schemars::Schema) {
if let Some(object) = schema.as_object_mut() {
if object.contains_key("properties")
&& !object.contains_key("additionalProperties")
&& !object.contains_key("unevaluatedProperties")
{
object.insert("additionalProperties".to_string(), false.into());
}
if let Some(object) = schema.as_object_mut()
&& object.contains_key("properties")
&& !object.contains_key("additionalProperties")
&& !object.contains_key("unevaluatedProperties")
{
object.insert("additionalProperties".to_string(), false.into());
}
transform_subschemas(self, schema);
}

View file

@ -128,11 +128,9 @@ pub fn truncate_lines_to_byte_limit(s: &str, max_bytes: usize) -> &str {
}
for i in (0..max_bytes).rev() {
if s.is_char_boundary(i) {
if s.as_bytes()[i] == b'\n' {
// Since the i-th character is \n, valid to slice at i + 1.
return &s[..i + 1];
}
if s.is_char_boundary(i) && s.as_bytes()[i] == b'\n' {
// Since the i-th character is \n, valid to slice at i + 1.
return &s[..i + 1];
}
}