Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/tools/src/bin/cleanup_blockquotes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ fn main() {
buffer
};

let fixed = cleanup_blockquotes(input);
let fixed = cleanup_blockquotes(&input);
print!("{fixed}");
}

fn cleanup_blockquotes(input: String) -> String {
let normal_start = EXTRA_SPACE.replace_all(&input, ">");
fn cleanup_blockquotes(input: &str) -> String {
let normal_start = EXTRA_SPACE.replace_all(input, ">");
let sans_empty_leading = EMPTY_LEADING.replace_all(&normal_start, "\n\n");
sans_empty_leading.to_string()
}
Expand All @@ -42,7 +42,7 @@ mod tests {
#[test]
fn extra_space() {
let input = " > Hello".to_string();
let actual = cleanup_blockquotes(input);
let actual = cleanup_blockquotes(&input);
assert_eq!(actual, "> Hello");
}

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

let actual = cleanup_blockquotes(input);
let actual = cleanup_blockquotes(&input);
assert_eq!(
actual,
r#"
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/src/bin/concat_chapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn match_files(
) -> Vec<(PathBuf, PathBuf)> {
read_dir(source_dir)
.expect("Unable to read source directory")
.filter_map(|maybe_entry| maybe_entry.ok())
.filter_map(Result::ok)
.filter_map(|entry| {
let source_filename = entry.file_name();
let source_filename =
Expand Down
8 changes: 4 additions & 4 deletions packages/tools/src/bin/lfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ fn main() {
path.display(),
line_num,
line
)
);
}
LintingError::UnableToOpenFile => {
eprintln!("Unable to open {}.", path.display())
eprintln!("Unable to open {}.", path.display());
}
}
}
Expand Down Expand Up @@ -93,13 +93,13 @@ where
Ok(())
}
})
.filter(|result| result.is_err())
.filter(Result::is_err)
.map(|result| result.unwrap_err())
.collect()
}

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

fn is_line_of_interest(line: &str) -> bool {
Expand Down
Loading
Loading