mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Remove mem::replace usage
This commit is contained in:
parent
79a4f6d195
commit
e1706b0228
@ -47,15 +47,12 @@ impl EventuallyMapContext {
|
||||
tile_repository,
|
||||
..
|
||||
}) => {
|
||||
mem::replace(
|
||||
self,
|
||||
EventuallyMapContext::Full(MapContext {
|
||||
view_state,
|
||||
style,
|
||||
tile_repository,
|
||||
renderer,
|
||||
}),
|
||||
);
|
||||
*self = EventuallyMapContext::Full(MapContext {
|
||||
view_state,
|
||||
style,
|
||||
tile_repository,
|
||||
renderer,
|
||||
});
|
||||
}
|
||||
EventuallyMapContext::_Uninitialized => {}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ where
|
||||
};
|
||||
|
||||
if should_replace {
|
||||
mem::replace(self, Eventually::Initialized(f()));
|
||||
*self = Eventually::Initialized(f());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ impl<T> Eventually<T> {
|
||||
#[tracing::instrument(name = "initialize", skip_all)]
|
||||
pub fn initialize(&mut self, f: impl FnOnce() -> T) {
|
||||
if let Eventually::Uninitialized = self {
|
||||
mem::replace(self, Eventually::Initialized(f()));
|
||||
*self = Eventually::Initialized(f());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user