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 879eccead7
40 changed files with 77 additions and 75 deletions

View file

@ -113,7 +113,7 @@ pub fn get_attr<'a>(
fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'static str, mut f: F) {
for attr in get_attr(sess, attrs, name) {
if let Some(ref value) = attr.value_str() {
if let Ok(value) = FromStr::from_str(&value.as_str()) {
if let Ok(value) = FromStr::from_str(value.as_str()) {
f(value);
} else {
sess.span_err(attr.span, "not a number");

View file

@ -319,8 +319,8 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
if let ExprKind::Path(qpath) = &callee.kind;
let res = self.typeck_results.qpath_res(qpath, callee.hir_id);
if let Some(def_id) = res.opt_def_id();
let def_path: Vec<_> = self.lcx.get_def_path(def_id).into_iter().map(Symbol::as_str).collect();
let def_path: Vec<&str> = def_path.iter().take(4).map(|s| &**s).collect();
let def_path = self.lcx.get_def_path(def_id);
let def_path: Vec<&str> = def_path.iter().take(4).map(|s| s.as_str()).collect();
if let ["core", "num", int_impl, "max_value"] = *def_path;
then {
let value = match int_impl {

View file

@ -47,7 +47,7 @@ impl ops::BitOrAssign for EagernessSuggestion {
/// Determine the eagerness of the given function call.
fn fn_eagerness(cx: &LateContext<'tcx>, fn_id: DefId, name: Symbol, args: &'tcx [Expr<'_>]) -> EagernessSuggestion {
use EagernessSuggestion::{Eager, Lazy, NoChange};
let name = &*name.as_str();
let name = name.as_str();
let ty = match cx.tcx.impl_of_method(fn_id) {
Some(id) => cx.tcx.type_of(id),

View file

@ -372,7 +372,7 @@ fn is_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: Option<&RustcVersion>) -> b
// as a part of an unimplemented MSRV check https://github.com/rust-lang/rust/issues/65262.
crate::meets_msrv(
msrv,
&RustcVersion::parse(&since.as_str())
&RustcVersion::parse(since.as_str())
.expect("`rustc_attr::StabilityLevel::Stable::since` is ill-formatted"),
)
} else {