diff --git a/src/ast/stmt.rs b/src/ast/stmt.rs index c634bfc1..4a5ebcbf 100644 --- a/src/ast/stmt.rs +++ b/src/ast/stmt.rs @@ -216,7 +216,7 @@ impl IntoIterator for RangeCase { } impl RangeCase { - /// Is the range empty? + /// Returns `true` if the range contains no items. #[inline(always)] #[must_use] pub fn is_empty(&self) -> bool { @@ -356,7 +356,7 @@ impl StmtBlock { span: Span::new(pos, pos), } } - /// Is this statements block empty? + /// Returns `true` if this statements block contains no statements. #[inline(always)] #[must_use] pub fn is_empty(&self) -> bool { diff --git a/src/module/mod.rs b/src/module/mod.rs index 61e2f4c7..fb3e47ab 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -591,7 +591,7 @@ impl Module { self.custom_types.get(key) } - /// Is the [`Module`] empty? + /// Returns `true` if this [`Module`] contains no items. /// /// # Example /// diff --git a/src/module/resolvers/collection.rs b/src/module/resolvers/collection.rs index aa39329f..7aab4bd0 100644 --- a/src/module/resolvers/collection.rs +++ b/src/module/resolvers/collection.rs @@ -86,7 +86,7 @@ impl ModuleResolversCollection { self.0.clear(); self } - /// Is this [`ModuleResolversCollection`] empty? + /// Returns `true` if this [`ModuleResolversCollection`] contains no module resolvers. #[inline(always)] #[must_use] pub fn is_empty(&self) -> bool { diff --git a/src/module/resolvers/stat.rs b/src/module/resolvers/stat.rs index 3f556db2..b2d418c7 100644 --- a/src/module/resolvers/stat.rs +++ b/src/module/resolvers/stat.rs @@ -98,7 +98,7 @@ impl StaticModuleResolver { self.0.clear(); self } - /// Is this [`StaticModuleResolver`] empty? + /// Returns `true` if this [`StaticModuleResolver`] contains no module resolvers. #[inline(always)] #[must_use] pub fn is_empty(&self) -> bool { diff --git a/src/types/interner.rs b/src/types/interner.rs index da93de3c..8ce63284 100644 --- a/src/types/interner.rs +++ b/src/types/interner.rs @@ -63,23 +63,21 @@ impl StringsInterner<'_> { /// Get an identifier from a text string, adding it to the interner if necessary. #[inline(always)] #[must_use] - pub fn get + Into>(&mut self, text: T) -> ImmutableString { + pub fn get + Into>(&mut self, text: S) -> ImmutableString { self.get_with_mapper(|s| s.into(), text) } /// Get an identifier from a text string, adding it to the interner if necessary. #[inline] #[must_use] - pub fn get_with_mapper + Into>( + pub fn get_with_mapper>( &mut self, - mapper: fn(T) -> ImmutableString, - text: T, + mapper: fn(S) -> ImmutableString, + text: S, ) -> ImmutableString { let key = text.as_ref(); - // Do not intern long strings or numbers - if key.len() > MAX_STRING_LEN || key.bytes().all(|c| c == b'.' || (c >= b'0' && c <= b'9')) - { + if key.len() > MAX_STRING_LEN { return mapper(text); } @@ -133,7 +131,7 @@ impl StringsInterner<'_> { self.strings.len() } - /// Are there no interned strings? + /// Returns `true` if there are no interned strings. #[inline(always)] #[must_use] pub fn is_empty(&self) -> bool { diff --git a/src/types/scope.rs b/src/types/scope.rs index 8939c94b..46dd1d1f 100644 --- a/src/types/scope.rs +++ b/src/types/scope.rs @@ -214,7 +214,7 @@ impl Scope<'_> { pub fn len(&self) -> usize { self.values.len() } - /// Is the [`Scope`] empty? + /// Returns `true` if this [`Scope`] contains no variables. /// /// # Example ///