File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,17 @@ use crate::formatting::FileRecord;
1616
1717use 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.
2031pub ( crate ) fn append_newline ( s : & mut String ) {
2132 s. push ( '\n' ) ;
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`
You can’t perform that action at this time.
0 commit comments