Skip to content

Commit

Permalink
Fix non local definition in rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Jan 27, 2024
1 parent 4ed3c21 commit e9aeaaa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/tools/rustfmt/src/source_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ use crate::formatting::FileRecord;

use rustc_data_structures::sync::Lrc;

impl From<&FileName> for rustc_span::FileName {
fn from(filename: &FileName) -> rustc_span::FileName {
match filename {
FileName::Real(path) => {
rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(path.to_owned()))
}
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
}
}
}

// Append a newline to the end of each file.
pub(crate) fn append_newline(s: &mut String) {
s.push('\n');
Expand Down Expand Up @@ -66,17 +77,6 @@ where
}
}

impl From<&FileName> for rustc_span::FileName {
fn from(filename: &FileName) -> rustc_span::FileName {
match filename {
FileName::Real(path) => {
rustc_span::FileName::Real(rustc_span::RealFileName::LocalPath(path.to_owned()))
}
FileName::Stdin => rustc_span::FileName::Custom("stdin".to_owned()),
}
}
}

// SourceFile's in the SourceMap will always have Unix-style line endings
// See: https://github.com/rust-lang/rustfmt/issues/3850
// So if the user has explicitly overridden the rustfmt `newline_style`
Expand Down

0 comments on commit e9aeaaa

Please sign in to comment.