1
Fork 0

Remove redundant input_path field from Config

This commit is contained in:
Oli Scherer 2022-12-06 18:56:28 +00:00
parent 6b1a789fb6
commit f5c601492e
6 changed files with 25 additions and 15 deletions

View file

@ -591,6 +591,24 @@ impl Input {
Input::Str { ref name, .. } => name.clone(),
}
}
pub fn opt_path(&self) -> Option<PathBuf> {
match self {
Input::File(file) => Some(file.clone()),
Input::Str { name, .. } => match name {
FileName::Real(real) => real.local_path().map(|p| p.to_owned()),
FileName::QuoteExpansion(_) => None,
FileName::Anon(_) => None,
FileName::MacroExpansion(_) => None,
FileName::ProcMacroSourceCode(_) => None,
FileName::CfgSpec(_) => None,
FileName::CliCrateAttr(_) => None,
FileName::Custom(_) => None,
FileName::DocTest(path, _) => Some(path.to_owned()),
FileName::InlineAsm(_) => None,
},
}
}
}
#[derive(Clone, Hash, Debug, HashStable_Generic)]