Reduce usage of as_ref and as_mut.

This commit is contained in:
Stephen Chung
2022-07-05 16:26:38 +08:00
parent 9319f87a7b
commit b6528bd51d
33 changed files with 211 additions and 137 deletions

View File

@@ -137,7 +137,7 @@ impl Parse for Module {
Ok(vec)
})?;
// Gather and parse constants definitions.
for item in content.iter() {
for item in &*content {
match item {
syn::Item::Const(syn::ItemConst {
vis: syn::Visibility::Public(..),
@@ -156,7 +156,7 @@ impl Parse for Module {
}
}
// Gather and parse type definitions.
for item in content.iter() {
for item in &*content {
match item {
syn::Item::Type(syn::ItemType {
vis: syn::Visibility::Public(..),

View File

@@ -300,7 +300,7 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> {
let mut renames = BTreeMap::new();
let mut fn_defs = BTreeMap::new();
for item_fn in fns.iter() {
for item_fn in fns {
if !item_fn.params().name.is_empty() || item_fn.params().special != FnSpecialAccess::None {
let mut names: Vec<_> = item_fn
.params()