clean up few alloc
This commit is contained in:
parent
7ac4b82ddd
commit
1f01433607
@ -1480,7 +1480,7 @@ pub(crate) fn visibility_print_with_space<'a, 'tcx: 'a>(
|
||||
debug!("path={:?}", path);
|
||||
// modified from `resolved_path()` to work with `DefPathData`
|
||||
let last_name = path.data.last().unwrap().data.get_opt_name().unwrap();
|
||||
let anchor = anchor(vis_did, last_name, cx).to_string();
|
||||
let anchor = anchor(vis_did, last_name, cx);
|
||||
|
||||
let mut s = "pub(in ".to_owned();
|
||||
for seg in &path.data[..path.data.len() - 1] {
|
||||
|
@ -352,7 +352,7 @@ impl<'tcx> Context<'tcx> {
|
||||
},
|
||||
);
|
||||
|
||||
path = href.into_inner().to_string_lossy().to_string();
|
||||
path = href.into_inner().to_string_lossy().into_owned();
|
||||
|
||||
if let Some(c) = path.as_bytes().last() && *c != b'/' {
|
||||
path.push('/');
|
||||
|
@ -85,7 +85,7 @@ impl LocalSourcesCollector<'_, '_> {
|
||||
},
|
||||
);
|
||||
|
||||
let mut href = href.into_inner().to_string_lossy().to_string();
|
||||
let mut href = href.into_inner().to_string_lossy().into_owned();
|
||||
if let Some(c) = href.as_bytes().last() && *c != b'/' {
|
||||
href.push('/');
|
||||
}
|
||||
|
@ -286,7 +286,6 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
|
||||
split.next().map(|f| Symbol::intern(f)).ok_or_else(no_res)?;
|
||||
let path = split
|
||||
.next()
|
||||
.map(|f| f.to_owned())
|
||||
// If there's no third component, we saw `[a::b]` before and it failed to resolve.
|
||||
// So there's no partial res.
|
||||
.ok_or_else(no_res)?;
|
||||
@ -429,7 +428,6 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
|
||||
let item_name = Symbol::intern(item_str);
|
||||
let path_root = split
|
||||
.next()
|
||||
.map(|f| f.to_owned())
|
||||
// If there's no `::`, it's not an associated item.
|
||||
// So we can be sure that `rustc_resolve` was accurate when it said it wasn't resolved.
|
||||
.ok_or_else(|| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user