1
Fork 0

Fix even more clippy warnings

This commit is contained in:
Joshua Nelson 2020-10-26 21:02:48 -04:00
parent bfecb18771
commit 57c6ed0c07
53 changed files with 276 additions and 520 deletions

View file

@ -326,10 +326,8 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
) -> Result<Self::Path, Self::Error> {
self = print_prefix(self)?;
let args = args.iter().cloned().filter(|arg| match arg.unpack() {
GenericArgKind::Lifetime(_) => false,
_ => true,
});
let args =
args.iter().cloned().filter(|arg| !matches!(arg.unpack(), GenericArgKind::Lifetime(_)));
if args.clone().next().is_some() {
self.generic_delimiters(|cx| cx.comma_sep(args))

View file

@ -174,10 +174,7 @@ fn compute_symbol_name(
return tcx.sess.generate_proc_macro_decls_symbol(disambiguator);
}
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
match tcx.hir().get(hir_id) {
Node::ForeignItem(_) => true,
_ => false,
}
matches!(tcx.hir().get(hir_id), Node::ForeignItem(_))
} else {
tcx.is_foreign_item(def_id)
};
@ -200,15 +197,14 @@ fn compute_symbol_name(
// show up in the `wasm-import-name` custom attribute in LLVM IR.
//
// [1]: https://bugs.llvm.org/show_bug.cgi?id=44316
if is_foreign {
if tcx.sess.target.arch != "wasm32"
|| !tcx.wasm_import_module_map(def_id.krate).contains_key(&def_id)
{
if let Some(name) = attrs.link_name {
return name.to_string();
}
return tcx.item_name(def_id).to_string();
if is_foreign
&& (tcx.sess.target.arch != "wasm32"
|| !tcx.wasm_import_module_map(def_id.krate).contains_key(&def_id))
{
if let Some(name) = attrs.link_name {
return name.to_string();
}
return tcx.item_name(def_id).to_string();
}
if let Some(name) = attrs.export_name {
@ -234,10 +230,7 @@ fn compute_symbol_name(
// codegen units) then this symbol may become an exported (but hidden
// visibility) symbol. This means that multiple crates may do the same
// and we want to be sure to avoid any symbol conflicts here.
match MonoItem::Fn(instance).instantiation_mode(tcx) {
InstantiationMode::GloballyShared { may_conflict: true } => true,
_ => false,
};
matches!(MonoItem::Fn(instance).instantiation_mode(tcx), InstantiationMode::GloballyShared { may_conflict: true });
let instantiating_crate =
if avoid_cross_crate_conflicts { Some(compute_instantiating_crate()) } else { None };