Skip to content

Commit c1ffd4e

Browse files
committed
Replace get_or_insert_with with get_or_insert_default
1 parent d9c139b commit c1ffd4e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/chunk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl Compiler {
366366
self.libraries_with_known_members.push(lib.clone());
367367
}
368368
self.library_constants
369-
.get_or_insert_with(HashMap::new)
369+
.get_or_insert_default()
370370
.insert((lib, member), r#const.into());
371371
self
372372
}
@@ -666,7 +666,7 @@ impl Chunk<'_> {
666666
&& self.detect_mode() == ChunkMode::Text
667667
{
668668
#[cfg(feature = "luau")]
669-
if let Ok(data) = self.compiler.get_or_insert_with(Default::default).compile(source) {
669+
if let Ok(data) = self.compiler.get_or_insert_default().compile(source) {
670670
self.source = Ok(Cow::Owned(data));
671671
self.mode = Some(ChunkMode::Binary);
672672
}

src/state/raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ impl RawLua {
11261126
#[cfg(feature = "luau")]
11271127
if registry.enable_namecall {
11281128
let map: &mut rustc_hash::FxHashMap<_, crate::types::CallbackPtr> =
1129-
methods_map.get_or_insert_with(Default::default);
1129+
methods_map.get_or_insert_default();
11301130
for (k, m) in &registry.methods {
11311131
map.insert(k.as_bytes().to_vec(), &**m);
11321132
}

0 commit comments

Comments
 (0)