Skip to content

Commit 7ed5fa0

Browse files
Merge pull request #199 from bytecodealliance/clippy-fixes
Clippy fixes
2 parents 991ecf1 + 5a14c23 commit 7ed5fa0

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

crates/wac-graph/src/encoding.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use wasm_encoder::{
1717
/// A type used to abstract the API differences between a component builder,
1818
/// component type, and instance type from `wasm-encoder`.
1919
#[derive(Debug)]
20+
#[allow(clippy::large_enum_variant)]
2021
enum Encodable {
2122
Builder(ComponentBuilder),
2223
Instance(InstanceType),
@@ -48,15 +49,15 @@ impl Encodable {
4849
}
4950
}
5051

51-
fn ty(&mut self) -> ComponentTypeEncoder {
52+
fn ty(&mut self) -> ComponentTypeEncoder<'_> {
5253
match self {
5354
Encodable::Builder(t) => t.ty(None).1,
5455
Encodable::Instance(t) => t.ty(),
5556
Encodable::Component(t) => t.ty(),
5657
}
5758
}
5859

59-
fn core_type(&mut self) -> ComponentCoreTypeEncoder {
60+
fn core_type(&mut self) -> ComponentCoreTypeEncoder<'_> {
6061
match self {
6162
Encodable::Builder(t) => t.core_type(None).1,
6263
Encodable::Instance(t) => t.core_type(),

crates/wac-parser/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl<'a> Document<'a> {
359359
pub fn resolve(
360360
&self,
361361
packages: IndexMap<BorrowedPackageKey<'a>, Vec<u8>>,
362-
) -> ResolutionResult<Resolution> {
362+
) -> ResolutionResult<Resolution<'_>> {
363363
AstResolver::new(self).resolve(packages)
364364
}
365365
}

crates/wac-parser/src/ast/type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub enum TypeDecl<'a> {
6262

6363
impl TypeDecl<'_> {
6464
/// Gets the identifier of the type being declared.
65-
pub fn id(&self) -> &Ident {
65+
pub fn id(&self) -> &Ident<'_> {
6666
match self {
6767
Self::Variant(variant) => &variant.id,
6868
Self::Record(record) => &record.id,
@@ -787,7 +787,7 @@ impl<'a> Parse<'a> for Type<'a> {
787787
} else if Type::peek(&mut lookahead) {
788788
Ok(Some(Box::new(Parse::parse(lexer)?)))
789789
} else {
790-
return Err(lookahead.error());
790+
Err(lookahead.error())
791791
}
792792
})?
793793
.unwrap_or(None);
@@ -904,7 +904,7 @@ impl Peek for ItemTypeDecl<'_> {
904904

905905
impl ItemTypeDecl<'_> {
906906
/// Gets the identifier of the type being declared.
907-
pub fn id(&self) -> &Ident {
907+
pub fn id(&self) -> &Ident<'_> {
908908
match self {
909909
Self::Resource(resource) => &resource.id,
910910
Self::Variant(variant) => &variant.id,

crates/wac-parser/src/resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ pub struct Resolution<'a> {
666666

667667
impl Resolution<'_> {
668668
/// Gets the document that was resolved.
669-
pub fn document(&self) -> &Document {
669+
pub fn document(&self) -> &Document<'_> {
670670
self.document
671671
}
672672

crates/wac-types/src/package.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ impl fmt::Display for BorrowedPackageKey<'_> {
101101
/// A trait implemented by types that can be borrowed as a package key.
102102
pub trait BorrowedKey {
103103
/// Borrows the key as a borrowed package key.
104-
fn borrowed_key(&self) -> BorrowedPackageKey;
104+
fn borrowed_key(&self) -> BorrowedPackageKey<'_>;
105105
}
106106

107107
impl BorrowedKey for PackageKey {
108-
fn borrowed_key(&self) -> BorrowedPackageKey {
108+
fn borrowed_key(&self) -> BorrowedPackageKey<'_> {
109109
BorrowedPackageKey {
110110
name: &self.name,
111111
version: self.version.as_ref(),
@@ -114,7 +114,7 @@ impl BorrowedKey for PackageKey {
114114
}
115115

116116
impl BorrowedKey for BorrowedPackageKey<'_> {
117-
fn borrowed_key(&self) -> BorrowedPackageKey {
117+
fn borrowed_key(&self) -> BorrowedPackageKey<'_> {
118118
*self
119119
}
120120
}
@@ -125,15 +125,15 @@ impl<'a> Borrow<dyn BorrowedKey + 'a> for PackageKey {
125125
}
126126
}
127127

128-
impl Eq for (dyn BorrowedKey + '_) {}
128+
impl Eq for dyn BorrowedKey + '_ {}
129129

130-
impl PartialEq for (dyn BorrowedKey + '_) {
130+
impl PartialEq for dyn BorrowedKey + '_ {
131131
fn eq(&self, other: &dyn BorrowedKey) -> bool {
132132
self.borrowed_key().eq(&other.borrowed_key())
133133
}
134134
}
135135

136-
impl std::hash::Hash for (dyn BorrowedKey + '_) {
136+
impl std::hash::Hash for dyn BorrowedKey + '_ {
137137
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
138138
self.borrowed_key().hash(state)
139139
}
@@ -165,7 +165,7 @@ pub struct Package {
165165

166166
impl Package {
167167
/// Gets the package key for the package.
168-
pub fn key(&self) -> BorrowedPackageKey {
168+
pub fn key(&self) -> BorrowedPackageKey<'_> {
169169
BorrowedPackageKey::new(self)
170170
}
171171

0 commit comments

Comments
 (0)