Remove proc_macro2::FileName in favor of PathBuf
diff --git a/src/stable.rs b/src/stable.rs
index 0d8aac9..baeed69 100644
--- a/src/stable.rs
+++ b/src/stable.rs
@@ -6,6 +6,9 @@
use std::cmp;
use std::fmt;
use std::iter;
+#[cfg(procmacro2_semver_exempt)]
+use std::path::Path;
+use std::path::PathBuf;
use std::str::FromStr;
use std::vec;
@@ -190,29 +193,15 @@
}
}
-#[derive(Clone, PartialEq, Eq, Debug)]
-pub struct FileName(String);
-
-#[allow(dead_code)]
-pub fn file_name(s: String) -> FileName {
- FileName(s)
-}
-
-impl fmt::Display for FileName {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- self.0.fmt(f)
- }
-}
-
#[derive(Clone, PartialEq, Eq)]
pub struct SourceFile {
- name: FileName,
+ path: PathBuf,
}
impl SourceFile {
/// Get the path to this source file as a string.
- pub fn path(&self) -> &FileName {
- &self.name
+ pub fn path(&self) -> PathBuf {
+ self.path.clone()
}
pub fn is_real(&self) -> bool {
@@ -221,12 +210,6 @@
}
}
-impl AsRef<FileName> for SourceFile {
- fn as_ref(&self) -> &FileName {
- self.path()
- }
-}
-
impl fmt::Debug for SourceFile {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("SourceFile")
@@ -382,7 +365,7 @@
let cm = cm.borrow();
let fi = cm.fileinfo(*self);
SourceFile {
- name: FileName(fi.name.clone()),
+ path: Path::new(&fi.name).to_owned(),
}
})
}