Skip to content

Commit f0f1dd4

Browse files
authored
Merge pull request #97 from Juanperias/main
Clippy errors
2 parents 4a1f06c + b4ae7d3 commit f0f1dd4

8 files changed

Lines changed: 72 additions & 91 deletions

File tree

packages/tools/src/bin/cleanup_blockquotes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ fn main() {
2020
buffer
2121
};
2222

23-
let fixed = cleanup_blockquotes(input);
23+
let fixed = cleanup_blockquotes(&input);
2424
print!("{fixed}");
2525
}
2626

27-
fn cleanup_blockquotes(input: String) -> String {
28-
let normal_start = EXTRA_SPACE.replace_all(&input, ">");
27+
fn cleanup_blockquotes(input: &str) -> String {
28+
let normal_start = EXTRA_SPACE.replace_all(input, ">");
2929
let sans_empty_leading = EMPTY_LEADING.replace_all(&normal_start, "\n\n");
3030
sans_empty_leading.to_string()
3131
}
@@ -42,7 +42,7 @@ mod tests {
4242
#[test]
4343
fn extra_space() {
4444
let input = " > Hello".to_string();
45-
let actual = cleanup_blockquotes(input);
45+
let actual = cleanup_blockquotes(&input);
4646
assert_eq!(actual, "> Hello");
4747
}
4848

@@ -110,7 +110,7 @@ here, but `map` is more idiomatic.) In the body of the function we supply to
110110
a `String`. When all is said and done, we have an `Option<String>`.
111111
"#.to_string();
112112

113-
let actual = cleanup_blockquotes(input);
113+
let actual = cleanup_blockquotes(&input);
114114
assert_eq!(
115115
actual,
116116
r#"

packages/tools/src/bin/concat_chapters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn match_files(
4848
) -> Vec<(PathBuf, PathBuf)> {
4949
read_dir(source_dir)
5050
.expect("Unable to read source directory")
51-
.filter_map(|maybe_entry| maybe_entry.ok())
51+
.filter_map(Result::ok)
5252
.filter_map(|entry| {
5353
let source_filename = entry.file_name();
5454
let source_filename =

packages/tools/src/bin/lfp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ fn main() {
3535
path.display(),
3636
line_num,
3737
line
38-
)
38+
);
3939
}
4040
LintingError::UnableToOpenFile => {
41-
eprintln!("Unable to open {}.", path.display())
41+
eprintln!("Unable to open {}.", path.display());
4242
}
4343
}
4444
}
@@ -93,13 +93,13 @@ where
9393
Ok(())
9494
}
9595
})
96-
.filter(|result| result.is_err())
96+
.filter(Result::is_err)
9797
.map(|result| result.unwrap_err())
9898
.collect()
9999
}
100100

101101
fn is_file_of_interest(path: &path::Path) -> bool {
102-
path.extension().map_or(false, |ext| ext == "md")
102+
path.extension().is_some_and(|ext| ext == "md")
103103
}
104104

105105
fn is_line_of_interest(line: &str) -> bool {

0 commit comments

Comments
 (0)