File tree Expand file tree Collapse file tree 6 files changed +11
-12
lines changed Expand file tree Collapse file tree 6 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ pub struct Compiler {
134
134
#[ cfg( any( feature = "luau" , doc) ) ]
135
135
impl Default for Compiler {
136
136
fn default ( ) -> Self {
137
- Self :: new ( )
137
+ const { Self :: new ( ) }
138
138
}
139
139
}
140
140
@@ -323,8 +323,8 @@ impl<'a> Chunk<'a> {
323
323
/// necessary to populate the environment in order for scripts using custom environments to be
324
324
/// useful.
325
325
pub fn set_environment ( mut self , env : impl IntoLua ) -> Self {
326
- let lua = self . lua . lock ( ) ;
327
- let lua = lua . lua ( ) ;
326
+ let guard = self . lua . lock ( ) ;
327
+ let lua = guard . lua ( ) ;
328
328
self . env = env
329
329
. into_lua ( lua)
330
330
. and_then ( |val| lua. unpack ( val) )
@@ -357,8 +357,7 @@ impl<'a> Chunk<'a> {
357
357
///
358
358
/// This is equivalent to calling the chunk function with no arguments and no return values.
359
359
pub fn exec ( self ) -> Result < ( ) > {
360
- self . call :: < ( ) > ( ( ) ) ?;
361
- Ok ( ( ) )
360
+ self . call ( ( ) )
362
361
}
363
362
364
363
/// Asynchronously execute this chunk of code.
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ impl<T> Variadic<T> {
141
141
142
142
impl < T > Default for Variadic < T > {
143
143
fn default ( ) -> Variadic < T > {
144
- Variadic :: new ( )
144
+ const { Variadic :: new ( ) }
145
145
}
146
146
}
147
147
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ pub struct Options {
51
51
52
52
impl Default for Options {
53
53
fn default ( ) -> Self {
54
- Self :: new ( )
54
+ const { Self :: new ( ) }
55
55
}
56
56
}
57
57
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ pub struct Options {
52
52
53
53
impl Default for Options {
54
54
fn default ( ) -> Self {
55
- Self :: new ( )
55
+ const { Self :: new ( ) }
56
56
}
57
57
}
58
58
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ pub struct LuaOptions {
104
104
105
105
impl Default for LuaOptions {
106
106
fn default ( ) -> Self {
107
- LuaOptions :: new ( )
107
+ const { LuaOptions :: new ( ) }
108
108
}
109
109
}
110
110
@@ -1251,7 +1251,7 @@ impl Lua {
1251
1251
///
1252
1252
/// This methods provides a way to add fields or methods to userdata objects of a type `T`.
1253
1253
pub fn register_userdata_type < T : ' static > ( & self , f : impl FnOnce ( & mut UserDataRegistry < T > ) ) -> Result < ( ) > {
1254
- let mut registry = UserDataRegistry :: new ( ) ;
1254
+ let mut registry = const { UserDataRegistry :: new ( ) } ;
1255
1255
f ( & mut registry) ;
1256
1256
1257
1257
let lua = self . lock ( ) ;
Original file line number Diff line number Diff line change @@ -723,7 +723,7 @@ impl RawLua {
723
723
}
724
724
725
725
// Create a new metatable from `UserData` definition
726
- let mut registry = UserDataRegistry :: new ( ) ;
726
+ let mut registry = const { UserDataRegistry :: new ( ) } ;
727
727
T :: register ( & mut registry) ;
728
728
729
729
self . register_userdata_metatable ( registry)
@@ -742,7 +742,7 @@ impl RawLua {
742
742
}
743
743
744
744
// Create an empty metatable
745
- let registry = UserDataRegistry :: new ( ) ;
745
+ let registry = const { UserDataRegistry :: new ( ) } ;
746
746
self . register_userdata_metatable :: < T > ( registry)
747
747
} )
748
748
}
You can’t perform that action at this time.
0 commit comments