Skip to content

Commit

Permalink
gitignore: remove FIXME comment about passing path
Browse files Browse the repository at this point in the history
I looked through the code for the `ignore` crate, and this optional path
is not used anywhere. The only reason to pass it would be to be able to
get the path from the `Glob` when we call `Gitignore::matched` or
`Gitignore::matched_path_or_any_parents`, but we ignore the returned
`Glob` completely anyway. Passing the path would require an unnecessary
clone of the path for each line in every .gitignore file, so it's better
not to pass it since we don't need it.
  • Loading branch information
scott2000 committed Dec 17, 2024
1 parent 60078e9 commit d75cc94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/gitignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ impl GitIgnoreFile {
line: String::from_utf8_lossy(input_line).to_string(),
source: err,
})?;
// FIXME: do we need to provide the `from` argument? Is it for providing
// diagnostics or correctness?
// The `from` argument doesn't provide any diagnostics or correctness, so it is
// not required. It only allows retrieving the path from the `Glob` later, which
// we never do.
builder
.add_line(None, line)
.map_err(|err| GitIgnoreError::Underlying {
Expand Down

0 comments on commit d75cc94

Please sign in to comment.