1
Fork 0

Remove unnecessary sigils around Symbol::as_str() calls.

This commit is contained in:
Nicholas Nethercote 2021-12-15 14:39:23 +11:00
parent 8cddcd39ba
commit 056d48a2c9
104 changed files with 189 additions and 192 deletions

View file

@ -292,7 +292,7 @@ impl<'a> CrateLoader<'a> {
// `source` stores paths which are normalized which may be different
// from the strings on the command line.
let source = self.cstore.get_crate_data(cnum).cdata.source();
if let Some(entry) = self.sess.opts.externs.get(&name.as_str()) {
if let Some(entry) = self.sess.opts.externs.get(name.as_str()) {
// Only use `--extern crate_name=path` here, not `--extern crate_name`.
if let Some(mut files) = entry.files() {
if files.any(|l| {
@ -381,7 +381,7 @@ impl<'a> CrateLoader<'a> {
let host_hash = host_lib.as_ref().map(|lib| lib.metadata.get_root().hash());
let private_dep =
self.sess.opts.externs.get(&name.as_str()).map_or(false, |e| e.is_private_dep);
self.sess.opts.externs.get(name.as_str()).map_or(false, |e| e.is_private_dep);
// Claim this crate number and cache it
let cnum = self.cstore.alloc_new_crate_num();
@ -997,7 +997,7 @@ impl<'a> CrateLoader<'a> {
);
let name = match orig_name {
Some(orig_name) => {
validate_crate_name(self.sess, &orig_name.as_str(), Some(item.span));
validate_crate_name(self.sess, orig_name.as_str(), Some(item.span));
orig_name
}
None => item.ident.name,

View file

@ -315,7 +315,7 @@ impl<'a> CrateLocator<'a> {
exact_paths: if hash.is_none() {
sess.opts
.externs
.get(&crate_name.as_str())
.get(crate_name.as_str())
.into_iter()
.filter_map(|entry| entry.files())
.flatten()
@ -1175,7 +1175,7 @@ impl CrateError {
} else if crate_name
== Symbol::intern(&sess.opts.debugging_opts.profiler_runtime)
{
err.note(&"the compiler may have been built without the profiler runtime");
err.note("the compiler may have been built without the profiler runtime");
} else if crate_name.as_str().starts_with("rustc_") {
err.help(
"maybe you need to install the missing components with: \

View file

@ -67,7 +67,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
Some(name) => name,
None => continue, // skip like historical compilers
};
lib.kind = match &*kind.as_str() {
lib.kind = match kind.as_str() {
"static" => NativeLibKind::Static { bundle: None, whole_archive: None },
"static-nobundle" => {
sess.struct_span_warn(