Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/wac-graph/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use wasm_encoder::{
/// A type used to abstract the API differences between a component builder,
/// component type, and instance type from `wasm-encoder`.
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
enum Encodable {
Builder(ComponentBuilder),
Instance(InstanceType),
Expand Down Expand Up @@ -48,15 +49,15 @@ impl Encodable {
}
}

fn ty(&mut self) -> ComponentTypeEncoder {
fn ty(&mut self) -> ComponentTypeEncoder<'_> {
match self {
Encodable::Builder(t) => t.ty(None).1,
Encodable::Instance(t) => t.ty(),
Encodable::Component(t) => t.ty(),
}
}

fn core_type(&mut self) -> ComponentCoreTypeEncoder {
fn core_type(&mut self) -> ComponentCoreTypeEncoder<'_> {
match self {
Encodable::Builder(t) => t.core_type(None).1,
Encodable::Instance(t) => t.core_type(),
Expand Down
2 changes: 1 addition & 1 deletion crates/wac-parser/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl<'a> Document<'a> {
pub fn resolve(
&self,
packages: IndexMap<BorrowedPackageKey<'a>, Vec<u8>>,
) -> ResolutionResult<Resolution> {
) -> ResolutionResult<Resolution<'_>> {
AstResolver::new(self).resolve(packages)
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/wac-parser/src/ast/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub enum TypeDecl<'a> {

impl TypeDecl<'_> {
/// Gets the identifier of the type being declared.
pub fn id(&self) -> &Ident {
pub fn id(&self) -> &Ident<'_> {
match self {
Self::Variant(variant) => &variant.id,
Self::Record(record) => &record.id,
Expand Down Expand Up @@ -787,7 +787,7 @@ impl<'a> Parse<'a> for Type<'a> {
} else if Type::peek(&mut lookahead) {
Ok(Some(Box::new(Parse::parse(lexer)?)))
} else {
return Err(lookahead.error());
Err(lookahead.error())
}
})?
.unwrap_or(None);
Expand Down Expand Up @@ -904,7 +904,7 @@ impl Peek for ItemTypeDecl<'_> {

impl ItemTypeDecl<'_> {
/// Gets the identifier of the type being declared.
pub fn id(&self) -> &Ident {
pub fn id(&self) -> &Ident<'_> {
match self {
Self::Resource(resource) => &resource.id,
Self::Variant(variant) => &variant.id,
Expand Down
2 changes: 1 addition & 1 deletion crates/wac-parser/src/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ pub struct Resolution<'a> {

impl Resolution<'_> {
/// Gets the document that was resolved.
pub fn document(&self) -> &Document {
pub fn document(&self) -> &Document<'_> {
self.document
}

Expand Down
14 changes: 7 additions & 7 deletions crates/wac-types/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ impl fmt::Display for BorrowedPackageKey<'_> {
/// A trait implemented by types that can be borrowed as a package key.
pub trait BorrowedKey {
/// Borrows the key as a borrowed package key.
fn borrowed_key(&self) -> BorrowedPackageKey;
fn borrowed_key(&self) -> BorrowedPackageKey<'_>;
}

impl BorrowedKey for PackageKey {
fn borrowed_key(&self) -> BorrowedPackageKey {
fn borrowed_key(&self) -> BorrowedPackageKey<'_> {
BorrowedPackageKey {
name: &self.name,
version: self.version.as_ref(),
Expand All @@ -114,7 +114,7 @@ impl BorrowedKey for PackageKey {
}

impl BorrowedKey for BorrowedPackageKey<'_> {
fn borrowed_key(&self) -> BorrowedPackageKey {
fn borrowed_key(&self) -> BorrowedPackageKey<'_> {
*self
}
}
Expand All @@ -125,15 +125,15 @@ impl<'a> Borrow<dyn BorrowedKey + 'a> for PackageKey {
}
}

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

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

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

impl Package {
/// Gets the package key for the package.
pub fn key(&self) -> BorrowedPackageKey {
pub fn key(&self) -> BorrowedPackageKey<'_> {
BorrowedPackageKey::new(self)
}

Expand Down