summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mlua_derive/src/token.rs5
-rw-r--r--src/lua.rs2
-rw-r--r--src/serde/de.rs2
-rw-r--r--src/serde/ser.rs3
4 files changed, 9 insertions, 3 deletions
diff --git a/mlua_derive/src/token.rs b/mlua_derive/src/token.rs
index 0173118..95eba3d 100644
--- a/mlua_derive/src/token.rs
+++ b/mlua_derive/src/token.rs
@@ -175,8 +175,7 @@ impl Tokens {
pub(crate) fn retokenize(tt: TokenStream) -> Tokens {
Tokens(
tt.into_iter()
- .map(Tokens::from)
- .flatten()
+ .flat_map(Tokens::from)
.peekable()
.batching(|iter| {
// Find variable tokens
@@ -217,7 +216,7 @@ impl From<TokenTree> for Tokens {
vec![Token::new_delim(b, tt.clone(), true)]
.into_iter()
- .chain(g.stream().into_iter().map(Tokens::from).flatten())
+ .chain(g.stream().into_iter().flat_map(Tokens::from))
.chain(vec![Token::new_delim(e, tt, false)])
.collect()
}
diff --git a/src/lua.rs b/src/lua.rs
index e48c0b8..923f156 100644
--- a/src/lua.rs
+++ b/src/lua.rs
@@ -180,6 +180,7 @@ impl LuaOptions {
/// Sets [`catch_rust_panics`] option.
///
/// [`catch_rust_panics`]: #structfield.catch_rust_panics
+ #[must_use]
pub const fn catch_rust_panics(mut self, enabled: bool) -> Self {
self.catch_rust_panics = enabled;
self
@@ -190,6 +191,7 @@ impl LuaOptions {
/// [`thread_cache_size`]: #structfield.thread_cache_size
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
+ #[must_use]
pub const fn thread_cache_size(mut self, size: usize) -> Self {
self.thread_cache_size = size;
self
diff --git a/src/serde/de.rs b/src/serde/de.rs
index bda7f24..437de1d 100644
--- a/src/serde/de.rs
+++ b/src/serde/de.rs
@@ -61,6 +61,7 @@ impl Options {
/// Sets [`deny_unsupported_types`] option.
///
/// [`deny_unsupported_types`]: #structfield.deny_unsupported_types
+ #[must_use]
pub const fn deny_unsupported_types(mut self, enabled: bool) -> Self {
self.deny_unsupported_types = enabled;
self
@@ -69,6 +70,7 @@ impl Options {
/// Sets [`deny_recursive_tables`] option.
///
/// [`deny_recursive_tables`]: #structfield.deny_recursive_tables
+ #[must_use]
pub fn deny_recursive_tables(mut self, enabled: bool) -> Self {
self.deny_recursive_tables = enabled;
self
diff --git a/src/serde/ser.rs b/src/serde/ser.rs
index c6155ae..cb2141e 100644
--- a/src/serde/ser.rs
+++ b/src/serde/ser.rs
@@ -69,6 +69,7 @@ impl Options {
/// Sets [`set_array_metatable`] option.
///
/// [`set_array_metatable`]: #structfield.set_array_metatable
+ #[must_use]
pub const fn set_array_metatable(mut self, enabled: bool) -> Self {
self.set_array_metatable = enabled;
self
@@ -77,6 +78,7 @@ impl Options {
/// Sets [`serialize_none_to_null`] option.
///
/// [`serialize_none_to_null`]: #structfield.serialize_none_to_null
+ #[must_use]
pub const fn serialize_none_to_null(mut self, enabled: bool) -> Self {
self.serialize_none_to_null = enabled;
self
@@ -85,6 +87,7 @@ impl Options {
/// Sets [`serialize_unit_to_null`] option.
///
/// [`serialize_unit_to_null`]: #structfield.serialize_unit_to_null
+ #[must_use]
pub const fn serialize_unit_to_null(mut self, enabled: bool) -> Self {
self.serialize_unit_to_null = enabled;
self