tamer: relroot String->SymbolId
This was [one of] the last remaining Strings; SymbolId should be used across the board.main
parent
7873d46afb
commit
5ea5cffd09
|
@ -41,7 +41,7 @@ pub struct PackageAttrs {
|
|||
pub name: Option<SymbolId>,
|
||||
|
||||
/// Relative path from package to project root.
|
||||
pub relroot: Option<String>,
|
||||
pub relroot: Option<SymbolId>,
|
||||
|
||||
/// Whether this package is a program.
|
||||
///
|
||||
|
|
|
@ -213,7 +213,7 @@ fn output_xmle<'a>(
|
|||
depgraph: &'a LinkerAsg,
|
||||
sorted: &mut Sections<'a, IdentObject>,
|
||||
name: SymbolId,
|
||||
relroot: String,
|
||||
relroot: SymbolId,
|
||||
output: &str,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
if !sorted.map.is_empty() {
|
||||
|
@ -237,8 +237,7 @@ fn output_xmle<'a>(
|
|||
let file = fs::File::create(output)?;
|
||||
let mut buf = BufWriter::new(file);
|
||||
|
||||
lower_iter(&sorted, name, relroot.intern())
|
||||
.write(&mut buf, Default::default())?;
|
||||
lower_iter(&sorted, name, relroot).write(&mut buf, Default::default())?;
|
||||
|
||||
buf.flush()?;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ where
|
|||
/// Relative path to project root once discovered.
|
||||
///
|
||||
/// This will be set by the first package encountered.
|
||||
pub relroot: Option<String>,
|
||||
pub relroot: Option<SymbolId>,
|
||||
}
|
||||
|
||||
impl<S, Ix> AsgBuilderState<S, Ix>
|
||||
|
@ -369,11 +369,11 @@ mod test {
|
|||
let mut sut = Sut::new();
|
||||
|
||||
let name = "name".intern();
|
||||
let relroot = "some/path".to_string();
|
||||
let relroot = "some/path".into();
|
||||
|
||||
let evs = vec![Ok(XmloEvent::Package(PackageAttrs {
|
||||
name: Some(name),
|
||||
relroot: Some(relroot.clone()),
|
||||
relroot: Some(relroot),
|
||||
..Default::default()
|
||||
}))];
|
||||
|
||||
|
|
|
@ -351,9 +351,9 @@ where
|
|||
ele: &'a BytesStart<'a>,
|
||||
) -> XmloResult<PackageAttrs> {
|
||||
let mut program = false;
|
||||
let mut elig: Option<SymbolId> = None;
|
||||
let mut name: Option<SymbolId> = None;
|
||||
let mut relroot: Option<String> = None;
|
||||
let mut elig = None;
|
||||
let mut name = None;
|
||||
let mut relroot = None;
|
||||
|
||||
for attr in ele.attributes().with_checks(false).filter_map(Result::ok) {
|
||||
match attr.key {
|
||||
|
@ -363,9 +363,8 @@ where
|
|||
}
|
||||
|
||||
b"__rootpath" => {
|
||||
relroot = Some(unsafe {
|
||||
String::from_utf8_unchecked(attr.value.to_vec())
|
||||
});
|
||||
relroot =
|
||||
Some(unsafe { (&attr.value).intern_utf8_unchecked() });
|
||||
}
|
||||
|
||||
b"program" => {
|
||||
|
|
Loading…
Reference in New Issue