Skip to content

Commit e9aeaaa

Browse files
committed
Fix non local definition in rustfmt
1 parent 4ed3c21 commit e9aeaaa

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/tools/rustfmt/src/source_file.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ use crate::formatting::FileRecord;
1616

1717
use rustc_data_structures::sync::Lrc;
1818

19+
impl From<&FileName> for rustc_span::FileName {
20+
fn from(filename: &FileName) -> rustc_span::FileName {
21+
match filename {
22+
FileName::Real(path) => {
23+
rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(path.to_owned()))
24+
}
25+
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
26+
}
27+
}
28+
}
29+
1930
// Append a newline to the end of each file.
2031
pub(crate) fn append_newline(s: &mut String) {
2132
s.push('\n');
@@ -66,17 +77,6 @@ where
6677
}
6778
}
6879

69-
impl From<&FileName> for rustc_span::FileName {
70-
fn from(filename: &FileName) -> rustc_span::FileName {
71-
match filename {
72-
FileName::Real(path) => {
73-
rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(path.to_owned()))
74-
}
75-
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
76-
}
77-
}
78-
}
79-
8080
// SourceFile's in the SourceMap will always have Unix-style line endings
8181
// See: https://github.com/rust-lang/rustfmt/issues/3850
8282
// So if the user has explicitly overridden the rustfmt `newline_style`

0 commit comments

Comments
 (0)