1
Fork 0

Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk

Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
This commit is contained in:
bors 2021-12-19 09:31:37 +00:00
commit a41a6925ba
140 changed files with 354 additions and 415 deletions

View file

@ -609,7 +609,7 @@ fn check_must_not_suspend_def(
// Add optional reason note
if let Some(note) = attr.value_str() {
// FIXME(guswynn): consider formatting this better
err.span_note(data.source_span, &note.as_str());
err.span_note(data.source_span, note.as_str());
}
// Add some quick suggestions on what to do

View file

@ -1038,7 +1038,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
.collect();
// Sort them by the name so we have a stable result.
names.sort_by_cached_key(|n| n.as_str());
names.sort_by(|a, b| a.as_str().partial_cmp(b.as_str()).unwrap());
names
}
@ -1908,7 +1908,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
.associated_items(def_id)
.in_definition_order()
.filter(|x| {
let dist = lev_distance(&*name.as_str(), &x.ident.as_str());
let dist = lev_distance(name.as_str(), x.ident.as_str());
x.kind.namespace() == Namespace::ValueNS && dist > 0 && dist <= max_dist
})
.copied()

View file

@ -2849,7 +2849,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
);
} else if attr.has_name(sym::linkage) {
if let Some(val) = attr.value_str() {
codegen_fn_attrs.linkage = Some(linkage_by_name(tcx, id, &val.as_str()));
codegen_fn_attrs.linkage = Some(linkage_by_name(tcx, id, val.as_str()));
}
} else if attr.has_name(sym::link_section) {
if let Some(val) = attr.value_str() {