diff --git a/examples/custom_types.rs b/examples/custom_types.rs index 3fa7c7ef..ba57de58 100644 --- a/examples/custom_types.rs +++ b/examples/custom_types.rs @@ -36,6 +36,8 @@ fn main() -> Result<(), Box> { type Item = i64; type IntoIter = std::vec::IntoIter; + #[inline] + #[must_use] fn into_iter(self) -> Self::IntoIter { vec![self.x - 1, self.x, self.x + 1].into_iter() } diff --git a/src/api/custom_syntax.rs b/src/api/custom_syntax.rs index 080d4477..7ee568c0 100644 --- a/src/api/custom_syntax.rs +++ b/src/api/custom_syntax.rs @@ -157,7 +157,6 @@ impl Deref for Expression<'_> { type Target = Expr; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { self.0 } diff --git a/src/api/definitions/mod.rs b/src/api/definitions/mod.rs index 73908d04..cd0a51c2 100644 --- a/src/api/definitions/mod.rs +++ b/src/api/definitions/mod.rs @@ -77,6 +77,7 @@ pub struct DefinitionsConfig { impl Default for DefinitionsConfig { #[inline(always)] + #[must_use] fn default() -> Self { Self { write_headers: false, diff --git a/src/api/limits.rs b/src/api/limits.rs index 18eb17f1..9c70c132 100644 --- a/src/api/limits.rs +++ b/src/api/limits.rs @@ -75,6 +75,7 @@ impl Limits { impl Default for Limits { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } diff --git a/src/ast/ast.rs b/src/ast/ast.rs index eb606d3f..d0b88e26 100644 --- a/src/ast/ast.rs +++ b/src/ast/ast.rs @@ -36,6 +36,7 @@ pub struct AST { impl Default for AST { #[inline(always)] + #[must_use] fn default() -> Self { Self::empty() } diff --git a/src/ast/expr.rs b/src/ast/expr.rs index b7f4a836..76c9587d 100644 --- a/src/ast/expr.rs +++ b/src/ast/expr.rs @@ -75,8 +75,8 @@ impl CustomExpr { /// Is this custom syntax self-terminated (i.e. no need for a semicolon terminator)? /// /// A self-terminated custom syntax always ends in `$block$`, `}` or `;` - #[must_use] #[inline(always)] + #[must_use] pub const fn is_self_terminated(&self) -> bool { self.self_terminated } @@ -281,7 +281,6 @@ impl Deref for FloatWrapper { type Target = F; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { &self.0 } @@ -290,7 +289,6 @@ impl Deref for FloatWrapper { #[cfg(not(feature = "no_float"))] impl DerefMut for FloatWrapper { #[inline(always)] - #[must_use] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -447,6 +445,7 @@ pub enum Expr { impl Default for Expr { #[inline(always)] + #[must_use] fn default() -> Self { Self::Unit(Position::NONE) } diff --git a/src/ast/ident.rs b/src/ast/ident.rs index eb84c432..e8eb6626 100644 --- a/src/ast/ident.rs +++ b/src/ast/ident.rs @@ -40,7 +40,6 @@ impl Deref for Ident { type Target = ImmutableString; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { &self.name } @@ -48,7 +47,6 @@ impl Deref for Ident { impl DerefMut for Ident { #[inline(always)] - #[must_use] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.name } diff --git a/src/ast/namespace.rs b/src/ast/namespace.rs index 88ac8600..e0939384 100644 --- a/src/ast/namespace.rs +++ b/src/ast/namespace.rs @@ -72,7 +72,6 @@ impl Deref for Namespace { type Target = StaticVec; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { &self.path } @@ -80,7 +79,6 @@ impl Deref for Namespace { impl DerefMut for Namespace { #[inline(always)] - #[must_use] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.path } diff --git a/src/ast/stmt.rs b/src/ast/stmt.rs index ba6f0821..a763860c 100644 --- a/src/ast/stmt.rs +++ b/src/ast/stmt.rs @@ -209,6 +209,7 @@ impl IntoIterator for RangeCase { type IntoIter = Box>; #[inline(always)] + #[must_use] fn into_iter(self) -> Self::IntoIter { match self { Self::ExclusiveInt(r, ..) => Box::new(r), @@ -426,7 +427,6 @@ impl Deref for StmtBlock { type Target = StmtBlockContainer; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { &self.block } @@ -434,7 +434,6 @@ impl Deref for StmtBlock { impl DerefMut for StmtBlock { #[inline(always)] - #[must_use] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.block } @@ -607,6 +606,7 @@ pub enum Stmt { impl Default for Stmt { #[inline(always)] + #[must_use] fn default() -> Self { Self::Noop(Position::NONE) } diff --git a/src/engine.rs b/src/engine.rs index fb905cde..cb4cb094 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -190,6 +190,7 @@ impl fmt::Debug for Engine { impl Default for Engine { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } diff --git a/src/eval/debugger.rs b/src/eval/debugger.rs index e98771e7..d6a33624 100644 --- a/src/eval/debugger.rs +++ b/src/eval/debugger.rs @@ -48,6 +48,7 @@ pub enum DebuggerCommand { impl Default for DebuggerCommand { #[inline(always)] + #[must_use] fn default() -> Self { Self::Continue } diff --git a/src/eval/global_state.rs b/src/eval/global_state.rs index 20ee2614..3d271af2 100644 --- a/src/eval/global_state.rs +++ b/src/eval/global_state.rs @@ -316,7 +316,6 @@ impl IntoIterator for GlobalRuntimeState<'_> { std::iter::Rev; 3]>>, >; - #[inline] fn into_iter(self) -> Self::IntoIter { self.keys .into_iter() @@ -333,10 +332,8 @@ impl<'a> IntoIterator for &'a GlobalRuntimeState<'_> { std::iter::Rev>>, >; - #[inline] fn into_iter(self) -> Self::IntoIter { - let x = self.keys.iter().rev().zip(self.modules.iter().rev()); - x + self.keys.iter().rev().zip(self.modules.iter().rev()) } } diff --git a/src/eval/target.rs b/src/eval/target.rs index 3b47533d..5a441520 100644 --- a/src/eval/target.rs +++ b/src/eval/target.rs @@ -399,7 +399,6 @@ impl Deref for Target<'_> { type Target = Dynamic; #[inline] - #[must_use] fn deref(&self) -> &Dynamic { match self { Self::RefMut(r) => r, @@ -425,7 +424,6 @@ impl AsRef for Target<'_> { impl DerefMut for Target<'_> { #[inline] - #[must_use] fn deref_mut(&mut self) -> &mut Dynamic { match self { Self::RefMut(r) => r, diff --git a/src/func/func.rs b/src/func/func.rs index f74873c1..7d211879 100644 --- a/src/func/func.rs +++ b/src/func/func.rs @@ -46,6 +46,7 @@ pub trait Func { /// func(123, "hello")? == false; // call the anonymous function /// # Ok(()) /// # } + #[must_use] fn create_from_ast(self, ast: AST, entry_point: &str) -> Self::Output; /// Create a Rust closure from a script. @@ -79,6 +80,7 @@ pub trait Func { /// # Ok(()) /// # } /// ``` + #[must_use] fn create_from_script(self, script: &str, entry_point: &str) -> ParseResult; } diff --git a/src/func/hashing.rs b/src/func/hashing.rs index cee84062..de261de7 100644 --- a/src/func/hashing.rs +++ b/src/func/hashing.rs @@ -41,6 +41,7 @@ pub struct StraightHasher(u64); impl Hasher for StraightHasher { #[inline(always)] + #[must_use] fn finish(&self) -> u64 { self.0 } @@ -66,6 +67,7 @@ impl BuildHasher for StraightHasherBuilder { type Hasher = StraightHasher; #[inline(always)] + #[must_use] fn build_hasher(&self) -> Self::Hasher { StraightHasher(ALT_ZERO_HASH) } diff --git a/src/func/register.rs b/src/func/register.rs index 37cc6bd0..928b08b0 100644 --- a/src/func/register.rs +++ b/src/func/register.rs @@ -86,8 +86,11 @@ pub trait RegisterNativeFunction { /// _(metadata)_ Get the type name of this function's return value. /// Exported under the `metadata` feature only. #[cfg(feature = "metadata")] + #[inline(always)] #[must_use] - fn return_type_name() -> &'static str; + fn return_type_name() -> &'static str { + std::any::type_name::() + } } const EXPECT_ARGS: &str = "arguments"; @@ -138,7 +141,6 @@ macro_rules! def_register { #[inline(always)] fn param_types() -> Box<[TypeId]> { vec![$(TypeId::of::<$par>()),*].into_boxed_slice() } #[cfg(feature = "metadata")] #[inline(always)] fn param_names() -> Box<[&'static str]> { vec![$(std::any::type_name::<$param>()),*].into_boxed_slice() } #[cfg(feature = "metadata")] #[inline(always)] fn return_type() -> TypeId { TypeId::of::() } - #[cfg(feature = "metadata")] #[inline(always)] fn return_type_name() -> &'static str { std::any::type_name::() } #[inline(always)] fn into_callable_function(self) -> CallableFunction { CallableFunction::$abi(Shared::new(move |_ctx: NativeCallContext, args: &mut FnCallArgs| { // The arguments are assumed to be of the correct number and types! @@ -164,7 +166,6 @@ macro_rules! def_register { #[inline(always)] fn param_types() -> Box<[TypeId]> { vec![$(TypeId::of::<$par>()),*].into_boxed_slice() } #[cfg(feature = "metadata")] #[inline(always)] fn param_names() -> Box<[&'static str]> { vec![$(std::any::type_name::<$param>()),*].into_boxed_slice() } #[cfg(feature = "metadata")] #[inline(always)] fn return_type() -> TypeId { TypeId::of::() } - #[cfg(feature = "metadata")] #[inline(always)] fn return_type_name() -> &'static str { std::any::type_name::() } #[inline(always)] fn into_callable_function(self) -> CallableFunction { CallableFunction::$abi(Shared::new(move |ctx: NativeCallContext, args: &mut FnCallArgs| { // The arguments are assumed to be of the correct number and types! diff --git a/src/func/script.rs b/src/func/script.rs index 8ccc876b..8d8139d6 100644 --- a/src/func/script.rs +++ b/src/func/script.rs @@ -251,12 +251,9 @@ impl Engine { // Then check sub-modules || self.global_sub_modules.values().any(|m| m.contains_qualified_fn(hash_script)); - if !result { - if cache.filter.is_absent(hash_script) { - cache.filter.mark(hash_script); - } else { - cache.map.insert(hash_script, None); - } + if !result && !cache.filter.is_absent_and_set(hash_script) { + // Do not cache "one-hit wonders" + cache.map.insert(hash_script, None); } result diff --git a/src/module/mod.rs b/src/module/mod.rs index fb94e590..0479ee70 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -196,6 +196,7 @@ pub struct Module { impl Default for Module { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } diff --git a/src/module/resolvers/collection.rs b/src/module/resolvers/collection.rs index 7aab4bd0..fd6780d4 100644 --- a/src/module/resolvers/collection.rs +++ b/src/module/resolvers/collection.rs @@ -42,7 +42,7 @@ impl ModuleResolversCollection { /// ``` #[inline(always)] #[must_use] - pub fn new() -> Self { + pub const fn new() -> Self { Self(Vec::new()) } /// Append a [module resolver][ModuleResolver] to the end. @@ -112,6 +112,7 @@ impl IntoIterator for ModuleResolversCollection { type IntoIter = IntoIter>; #[inline(always)] + #[must_use] fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } diff --git a/src/module/resolvers/file.rs b/src/module/resolvers/file.rs index 729e772f..07718c6c 100644 --- a/src/module/resolvers/file.rs +++ b/src/module/resolvers/file.rs @@ -56,6 +56,7 @@ pub struct FileModuleResolver { impl Default for FileModuleResolver { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } diff --git a/src/module/resolvers/stat.rs b/src/module/resolvers/stat.rs index 4019fc6d..8338a43a 100644 --- a/src/module/resolvers/stat.rs +++ b/src/module/resolvers/stat.rs @@ -134,6 +134,7 @@ impl IntoIterator for StaticModuleResolver { type IntoIter = IntoIter>; #[inline(always)] + #[must_use] fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } diff --git a/src/optimizer.rs b/src/optimizer.rs index c46cf43f..79e1c130 100644 --- a/src/optimizer.rs +++ b/src/optimizer.rs @@ -38,6 +38,7 @@ pub enum OptimizationLevel { impl Default for OptimizationLevel { #[inline(always)] + #[must_use] fn default() -> Self { Self::Simple } diff --git a/src/packages/mod.rs b/src/packages/mod.rs index ab4df033..5a63e86b 100644 --- a/src/packages/mod.rs +++ b/src/packages/mod.rs @@ -45,11 +45,14 @@ pub use time_basic::BasicTimePackage; pub trait Package { /// Initialize the package. /// Functions should be registered into `module` here. + #[cold] fn init(module: &mut Module); /// Initialize the package with an [`Engine`]. /// /// Perform tasks such as registering custom operators/syntax. + #[cold] + #[inline] #[allow(unused_variables)] fn init_engine(engine: &mut Engine) {} @@ -65,6 +68,8 @@ pub trait Package { /// /// package.register_into_engine(&mut engine); /// ``` + #[cold] + #[inline] fn register_into_engine(&self, engine: &mut Engine) -> &Self { Self::init_engine(engine); engine.register_global_module(self.as_shared_module()); @@ -84,6 +89,8 @@ pub trait Package { /// package.register_into_engine_as(&mut engine, "core"); /// ``` #[cfg(not(feature = "no_module"))] + #[cold] + #[inline] fn register_into_engine_as(&self, engine: &mut Engine, name: &str) -> &Self { Self::init_engine(engine); engine.register_static_module(name, self.as_shared_module()); @@ -133,7 +140,6 @@ macro_rules! def_package { fn as_shared_module(&self) -> $crate::Shared<$crate::Module> { self.0.clone() } - #[inline] fn init($lib: &mut $crate::Module) { $($( $(#[$base_meta])* { <$base_pkg>::init($lib); } @@ -141,7 +147,6 @@ macro_rules! def_package { $block } - #[inline] fn init_engine(_engine: &mut $crate::Engine) { $($( $(#[$base_meta])* { <$base_pkg>::init_engine(_engine); } @@ -156,6 +161,7 @@ macro_rules! def_package { impl Default for $package { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } @@ -193,12 +199,16 @@ macro_rules! def_package { } impl Default for $package { + #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } } impl $package { + #[inline] + #[must_use] pub fn new() -> Self { let mut module = $root::Module::new(); ::init(&mut module); @@ -229,12 +239,16 @@ macro_rules! def_package { } impl Default for $package { + #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } } impl $package { + #[inline] + #[must_use] pub fn new() -> Self { let mut module = $root::Module::new(); ::init(&mut module); diff --git a/src/parser.rs b/src/parser.rs index 6cdf3d18..d10f132c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -110,7 +110,7 @@ impl fmt::Debug for ParseState<'_> { impl<'e> ParseState<'e> { /// Create a new [`ParseState`]. - #[inline(always)] + #[inline] #[must_use] pub fn new( engine: &Engine, @@ -183,7 +183,6 @@ impl<'e> ParseState<'e> { /// /// * `is_func_name`: `true` if the variable is actually the name of a function /// (in which case it will be converted into a function pointer). - #[inline] #[must_use] pub fn access_var( &mut self, @@ -235,7 +234,6 @@ impl<'e> ParseState<'e> { /// /// Panics when called under `no_module`. #[cfg(not(feature = "no_module"))] - #[inline] #[must_use] pub fn find_module(&self, name: &str) -> Option { self.imports @@ -258,7 +256,7 @@ impl<'e> ParseState<'e> { /// Get an interned property getter, creating one if it is not yet interned. #[cfg(not(feature = "no_object"))] - #[inline(always)] + #[inline] #[must_use] pub fn get_interned_getter( &mut self, @@ -273,7 +271,7 @@ impl<'e> ParseState<'e> { /// Get an interned property setter, creating one if it is not yet interned. #[cfg(not(feature = "no_object"))] - #[inline(always)] + #[inline] #[must_use] pub fn get_interned_setter( &mut self, @@ -313,7 +311,7 @@ struct ParseSettings { impl ParseSettings { /// Create a new `ParseSettings` with one higher expression level. - #[inline(always)] + #[inline] #[must_use] pub const fn level_up(&self) -> Self { Self { @@ -417,7 +415,6 @@ impl Expr { } /// Make sure that the next expression is not a statement expression (i.e. wrapped in `{}`). -#[inline] fn ensure_not_statement_expr( input: &mut TokenStream, type_name: &(impl ToString + ?Sized), @@ -429,7 +426,6 @@ fn ensure_not_statement_expr( } /// Make sure that the next expression is not a mis-typed assignment (i.e. `a = b` instead of `a == b`). -#[inline] fn ensure_not_assignment(input: &mut TokenStream) -> ParseResult<()> { match input.peek().expect(NEVER_ENDS) { (Token::Equals, pos) => Err(LexError::ImproperSymbol( @@ -446,7 +442,6 @@ fn ensure_not_assignment(input: &mut TokenStream) -> ParseResult<()> { /// # Panics /// /// Panics if the next token is not the expected one. -#[inline] fn eat_token(input: &mut TokenStream, expected_token: Token) -> Position { let (t, pos) = input.next().expect(NEVER_ENDS); @@ -462,7 +457,6 @@ fn eat_token(input: &mut TokenStream, expected_token: Token) -> Position { } /// Match a particular [token][Token], consuming it if matched. -#[inline] fn match_token(input: &mut TokenStream, token: Token) -> (bool, Position) { let (t, pos) = input.peek().expect(NEVER_ENDS); if *t == token { @@ -473,7 +467,6 @@ fn match_token(input: &mut TokenStream, token: Token) -> (bool, Position) { } /// Parse a variable name. -#[inline] fn parse_var_name(input: &mut TokenStream) -> ParseResult<(SmartString, Position)> { match input.next().expect(NEVER_ENDS) { // Variable name @@ -491,7 +484,6 @@ fn parse_var_name(input: &mut TokenStream) -> ParseResult<(SmartString, Position /// Parse a symbol. #[cfg(not(feature = "no_custom_syntax"))] -#[inline] fn parse_symbol(input: &mut TokenStream) -> ParseResult<(SmartString, Position)> { match input.next().expect(NEVER_ENDS) { // Symbol diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 81893066..6aa0ec43 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -32,7 +32,7 @@ pub struct TokenizerControlBlock { impl TokenizerControlBlock { /// Create a new `TokenizerControlBlock`. - #[inline(always)] + #[inline] #[must_use] pub const fn new() -> Self { Self { @@ -97,7 +97,7 @@ impl Position { /// # Panics /// /// Panics if `line` is zero. - #[inline(always)] + #[inline] #[must_use] pub const fn new(line: u16, position: u16) -> Self { assert!(line != 0, "line cannot be zero"); @@ -220,6 +220,7 @@ impl Position { impl Default for Position { #[inline(always)] + #[must_use] fn default() -> Self { Self::START } @@ -299,6 +300,8 @@ pub struct Span { } impl Default for Span { + #[inline(always)] + #[must_use] fn default() -> Self { Self::NONE } @@ -315,7 +318,7 @@ impl Span { Self { start, end } } /// Is this [`Span`] non-existent? - #[inline(always)] + #[inline] #[must_use] pub const fn is_none(&self) -> bool { self.start.is_none() && self.end.is_none() diff --git a/src/types/dynamic.rs b/src/types/dynamic.rs index 79e63abf..6572dbe4 100644 --- a/src/types/dynamic.rs +++ b/src/types/dynamic.rs @@ -153,7 +153,6 @@ impl<'d, T: Any + Clone> Deref for DynamicWriteLock<'d, T> { type Target = T; #[inline] - #[must_use] fn deref(&self) -> &Self::Target { match self.0 { DynamicWriteLockInner::Reference(ref reference) => *reference, @@ -165,7 +164,6 @@ impl<'d, T: Any + Clone> Deref for DynamicWriteLock<'d, T> { impl<'d, T: Any + Clone> DerefMut for DynamicWriteLock<'d, T> { #[inline] - #[must_use] fn deref_mut(&mut self) -> &mut Self::Target { match self.0 { DynamicWriteLockInner::Reference(ref mut reference) => *reference, diff --git a/src/types/immutable_string.rs b/src/types/immutable_string.rs index 7353f151..f6dba61a 100644 --- a/src/types/immutable_string.rs +++ b/src/types/immutable_string.rs @@ -53,7 +53,6 @@ impl Deref for ImmutableString { type Target = SmartString; #[inline(always)] - #[must_use] fn deref(&self) -> &Self::Target { &self.0 } @@ -148,6 +147,7 @@ impl FromStr for ImmutableString { type Err = (); #[inline(always)] + #[must_use] fn from_str(s: &str) -> Result { let s: SmartString = s.into(); Ok(Self(s.into())) @@ -156,6 +156,7 @@ impl FromStr for ImmutableString { impl FromIterator for ImmutableString { #[inline] + #[must_use] fn from_iter>(iter: T) -> Self { Self(iter.into_iter().collect::().into()) } @@ -163,6 +164,7 @@ impl FromIterator for ImmutableString { impl<'a> FromIterator<&'a char> for ImmutableString { #[inline] + #[must_use] fn from_iter>(iter: T) -> Self { Self(iter.into_iter().copied().collect::().into()) } @@ -170,6 +172,7 @@ impl<'a> FromIterator<&'a char> for ImmutableString { impl<'a> FromIterator<&'a str> for ImmutableString { #[inline] + #[must_use] fn from_iter>(iter: T) -> Self { Self(iter.into_iter().collect::().into()) } @@ -177,6 +180,7 @@ impl<'a> FromIterator<&'a str> for ImmutableString { impl FromIterator for ImmutableString { #[inline] + #[must_use] fn from_iter>(iter: T) -> Self { Self(iter.into_iter().collect::().into()) } @@ -184,6 +188,7 @@ impl FromIterator for ImmutableString { impl FromIterator for ImmutableString { #[inline] + #[must_use] fn from_iter>(iter: T) -> Self { Self(iter.into_iter().collect::().into()) } diff --git a/src/types/interner.rs b/src/types/interner.rs index 7ae35a35..5832dbe0 100644 --- a/src/types/interner.rs +++ b/src/types/interner.rs @@ -39,6 +39,7 @@ pub struct StringsInterner<'a> { impl Default for StringsInterner<'_> { #[inline(always)] + #[must_use] fn default() -> Self { Self::new() } diff --git a/src/types/scope.rs b/src/types/scope.rs index 169830b4..a3787421 100644 --- a/src/types/scope.rs +++ b/src/types/scope.rs @@ -128,7 +128,7 @@ impl IntoIterator for Scope<'_> { type Item = (String, Dynamic, Vec); type IntoIter = Box>; - #[inline] + #[must_use] fn into_iter(self) -> Self::IntoIter { Box::new( self.values @@ -143,7 +143,7 @@ impl<'a> IntoIterator for &'a Scope<'_> { type Item = (&'a Identifier, &'a Dynamic, &'a Vec); type IntoIter = Box + 'a>; - #[inline] + #[must_use] fn into_iter(self) -> Self::IntoIter { Box::new( self.values @@ -719,7 +719,6 @@ impl Scope<'_> { scope } /// Get an iterator to entries in the [`Scope`]. - #[inline] #[allow(dead_code)] pub(crate) fn into_iter(self) -> impl Iterator)> { self.names diff --git a/tests/build_type.rs b/tests/build_type.rs index 05b23bc2..4844a3b4 100644 --- a/tests/build_type.rs +++ b/tests/build_type.rs @@ -49,6 +49,8 @@ fn build_type() -> Result<(), Box> { type Item = INT; type IntoIter = std::vec::IntoIter; + #[inline] + #[must_use] fn into_iter(self) -> Self::IntoIter { vec![self.x, self.y, self.z].into_iter() } diff --git a/tests/for.rs b/tests/for.rs index 62112a12..92e68af1 100644 --- a/tests/for.rs +++ b/tests/for.rs @@ -337,6 +337,8 @@ impl IntoIterator for MyIterableType { type Item = char; type IntoIter = std::vec::IntoIter; + #[inline] + #[must_use] fn into_iter(self) -> Self::IntoIter { self.0.chars().collect::>().into_iter() }