chore: Fix several style lints (#17488)

It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz
2024-09-06 11:58:39 +02:00
committed by GitHub
parent 93249fc82b
commit e6c1c51b37
361 changed files with 3529 additions and 3586 deletions
+3 -3
View File
@@ -234,8 +234,8 @@ impl Eq for PathMatcher {}
impl PathMatcher {
pub fn new(globs: &[String]) -> Result<Self, globset::Error> {
let globs = globs
.into_iter()
.map(|glob| Glob::new(&glob))
.iter()
.map(|glob| Glob::new(glob))
.collect::<Result<Vec<_>, _>>()?;
let sources = globs.iter().map(|glob| glob.glob().to_owned()).collect();
let mut glob_builder = GlobSetBuilder::new();
@@ -263,7 +263,7 @@ impl PathMatcher {
let path_str = path.to_string_lossy();
let separator = std::path::MAIN_SEPARATOR_STR;
if path_str.ends_with(separator) {
return false;
false
} else {
self.glob.is_match(path_str.to_string() + separator)
}
+1 -1
View File
@@ -251,7 +251,7 @@ pub fn parse_env_output(env: &str, mut f: impl FnMut(String, String)) {
for line in env.split_terminator('\n') {
if let Some(separator_index) = line.find('=') {
if &line[..separator_index] != "" {
if !line[..separator_index].is_empty() {
if let Some((key, value)) = Option::zip(current_key.take(), current_value.take()) {
f(key, value)
}