We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c995c46 commit 6b1063dCopy full SHA for 6b1063d
rustfmt-core/rustfmt-lib/src/formatting/syntux/session/ignore_path.rs
@@ -1,3 +1,5 @@
1
+use std::path::Path;
2
+
3
use ignore::gitignore::{Gitignore, GitignoreBuilder};
4
5
use crate::config::{FileName, IgnoreList};
@@ -8,7 +10,11 @@ pub(crate) struct IgnorePathSet {
8
10
9
11
impl IgnorePathSet {
12
pub(crate) fn from_ignore_list(ignore_list: &IgnoreList) -> Result<Self, ignore::Error> {
- let mut ignore_builder = GitignoreBuilder::new(ignore_list.rustfmt_toml_path());
13
+ let root = ignore_list
14
+ .rustfmt_toml_path()
15
+ .parent()
16
+ .unwrap_or(&Path::new(""));
17
+ let mut ignore_builder = GitignoreBuilder::new(root);
18
19
for ignore_path in ignore_list {
20
ignore_builder.add_line(None, &ignore_path.to_string_lossy())?;
0 commit comments