diff --git a/crates/mun_abi/src/type_info.rs b/crates/mun_abi/src/type_info.rs index 7a51adba..8410b446 100644 --- a/crates/mun_abi/src/type_info.rs +++ b/crates/mun_abi/src/type_info.rs @@ -113,9 +113,7 @@ impl<'a> TypeDefinition<'a> { /// Returns the alignment of the type in bytes pub fn alignment(&self) -> usize { - self.alignment - .try_into() - .expect("cannot convert alignment to platform size") + self.alignment.into() } } diff --git a/crates/mun_hir/src/arena.rs b/crates/mun_hir/src/arena.rs index a66ec290..9f1ce1d5 100644 --- a/crates/mun_hir/src/arena.rs +++ b/crates/mun_hir/src/arena.rs @@ -132,9 +132,7 @@ impl Arena { } /// Iterate over the elements in the arena - pub fn iter( - &self, - ) -> impl Iterator, &T)> + ExactSizeIterator + DoubleEndedIterator { + pub fn iter(&self) -> impl ExactSizeIterator, &T)> + DoubleEndedIterator { self.data .iter() .enumerate() diff --git a/crates/mun_hir/src/code_model.rs b/crates/mun_hir/src/code_model.rs index 81fd8afb..71e6d87e 100644 --- a/crates/mun_hir/src/code_model.rs +++ b/crates/mun_hir/src/code_model.rs @@ -13,17 +13,13 @@ pub use self::{ function::Function, module::{Module, ModuleDef}, package::Package, - r#impl::{Impl, ImplData}, - r#struct::{Field, LocalFieldId, Struct, StructKind, StructMemoryKind}, + r#impl::ImplData, + r#struct::{Field, Struct, StructKind, StructMemoryKind}, src::HasSource, type_alias::TypeAlias, }; -pub use self::{ - function::FunctionData, - r#struct::{FieldData, StructData}, - type_alias::TypeAliasData, -}; +pub use self::{function::FunctionData, r#struct::StructData, type_alias::TypeAliasData}; /// The definitions that have a body. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/crates/mun_hir/src/item_scope.rs b/crates/mun_hir/src/item_scope.rs index 8335d92b..34885cae 100644 --- a/crates/mun_hir/src/item_scope.rs +++ b/crates/mun_hir/src/item_scope.rs @@ -80,12 +80,12 @@ impl ItemScope { } /// Returns an iterator over all declarations with this scope - pub fn declarations(&self) -> impl Iterator + ExactSizeIterator + '_ { + pub fn declarations(&self) -> impl ExactSizeIterator + '_ { self.defs.iter().copied() } /// Returns an iterator over all impls in this scope - pub fn impls(&self) -> impl Iterator + ExactSizeIterator + '_ { + pub fn impls(&self) -> impl ExactSizeIterator + '_ { self.impls.iter().copied() } diff --git a/crates/mun_hir/src/ty/infer.rs b/crates/mun_hir/src/ty/infer.rs index 69e5a909..ad98ebea 100644 --- a/crates/mun_hir/src/ty/infer.rs +++ b/crates/mun_hir/src/ty/infer.rs @@ -26,7 +26,6 @@ use crate::ids::DefWithBodyId; use crate::resolve::{resolver_for_expr, HasResolver}; use crate::ty::primitives::{FloatTy, IntTy}; use crate::ty::TyKind; -pub use type_variable::TypeVarId; mod coerce; diff --git a/crates/mun_hir/src/utils.rs b/crates/mun_hir/src/utils.rs index 89016867..bcfef2f7 100644 --- a/crates/mun_hir/src/utils.rs +++ b/crates/mun_hir/src/utils.rs @@ -25,7 +25,7 @@ pub mod tests { if let Some(file_id) = module.file_id(&db) { let source_file = db.parse(file_id); for err in source_file.errors() { - diags.push(format!("{:?}: {}", err.location(), err.to_string())); + diags.push(format!("{:?}: {}", err.location(), err)); } } } diff --git a/crates/mun_runtime/src/dispatch_table.rs b/crates/mun_runtime/src/dispatch_table.rs index d97ae2e9..62af1f99 100644 --- a/crates/mun_runtime/src/dispatch_table.rs +++ b/crates/mun_runtime/src/dispatch_table.rs @@ -13,7 +13,7 @@ pub struct DispatchTable { impl DispatchTable { /// Retrieves the [`FunctionDefinition`] corresponding to `fn_path`, if it exists. pub fn get_fn(&self, fn_path: &str) -> Option> { - self.functions.get(fn_path).map(Clone::clone) + self.functions.get(fn_path).cloned() } /// Retrieves the name of all available functions. diff --git a/crates/mun_runtime_capi/src/runtime.rs b/crates/mun_runtime_capi/src/runtime.rs index ed102af6..eba34453 100644 --- a/crates/mun_runtime_capi/src/runtime.rs +++ b/crates/mun_runtime_capi/src/runtime.rs @@ -402,7 +402,7 @@ mod tests { let lib_path = CString::new("some/path").expect("Invalid library path"); let type_id = <()>::type_info().clone().into(); - let functions = vec![ExternalFunctionDefinition { + let functions = [ExternalFunctionDefinition { name: ptr::null(), arg_types: ptr::null(), return_type: type_id, @@ -428,7 +428,7 @@ mod tests { let invalid_encoding = ['�', '\0']; let type_id = <()>::type_info().clone().into(); - let functions = vec![ExternalFunctionDefinition { + let functions = [ExternalFunctionDefinition { name: invalid_encoding.as_ptr().cast(), arg_types: ptr::null(), return_type: type_id, @@ -453,7 +453,7 @@ mod tests { let lib_path = CString::new("some/path").expect("Invalid library path"); let function_name = CString::new("foobar").unwrap(); - let functions = vec![ExternalFunctionDefinition { + let functions = [ExternalFunctionDefinition { name: function_name.as_ptr(), arg_types: ptr::null(), return_type: Type::null(), @@ -479,7 +479,7 @@ mod tests { let function_name = CString::new("foobar").unwrap(); let type_id = <()>::type_info().clone().into(); - let functions = vec![ExternalFunctionDefinition { + let functions = [ExternalFunctionDefinition { name: function_name.as_ptr(), arg_types: ptr::null(), return_type: type_id, @@ -506,7 +506,7 @@ mod tests { let arg_types = [Type::null()]; let type_id = <()>::type_info().clone().into(); - let functions = vec![ExternalFunctionDefinition { + let functions = [ExternalFunctionDefinition { name: function_name.as_ptr(), arg_types: &arg_types as _, return_type: type_id, diff --git a/crates/mun_syntax/src/syntax_node.rs b/crates/mun_syntax/src/syntax_node.rs index 55450b43..24e155d1 100644 --- a/crates/mun_syntax/src/syntax_node.rs +++ b/crates/mun_syntax/src/syntax_node.rs @@ -35,7 +35,7 @@ pub type SyntaxElement = rowan::NodeOrToken; pub type SyntaxNodeChildren = rowan::SyntaxNodeChildren; pub type SyntaxElementChildren = rowan::SyntaxElementChildren; -pub use rowan::{Direction, NodeOrToken}; +pub use rowan::Direction; pub struct SyntaxTreeBuilder { errors: Vec,