Skip to content

Commit

Permalink
Don't use strings to represent paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Jun 17, 2024
1 parent 2db0e69 commit c15e742
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions frontend/exporter/src/types/copied.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ impl<'s, S: UnderOwnerState<'s>, T: SInto<S, U>, U> SInto<S, Spanned<U>>
}
}

impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, String> for PathBuf {
fn sinto(&self, _: &S) -> String {
self.as_path().display().to_string()
impl<'tcx, S> SInto<S, PathBuf> for PathBuf {
fn sinto(&self, _: &S) -> PathBuf {
self.clone()
}
}

Expand All @@ -888,14 +888,10 @@ impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, String> for PathBuf {
)]
#[args(<S>, from: rustc_span::RealFileName, state: S as _s)]
pub enum RealFileName {
LocalPath(#[map(x.to_str().unwrap().into())] String),
#[map(RealFileName::Remapped {
local_path: local_path.as_ref().map(|path| path.to_str().unwrap().into()),
virtual_name: virtual_name.to_str().unwrap().into()
})]
LocalPath(PathBuf),
Remapped {
local_path: Option<String>,
virtual_name: String,
local_path: Option<PathBuf>,
virtual_name: PathBuf,
},
}

Expand Down

0 comments on commit c15e742

Please sign in to comment.