EmptyPathStream is only used in android/wasm32 (#14200)

# Objective

- `EmptyPathStream` is only used in android and wasm32
- This now makes rust nightly warn

## Solution

- flag the struct to only be present when needed
- also change how `MorphTargetNames` is used because that makes rust
happier?
This commit is contained in:
François Mockers 2024-07-07 21:54:53 +02:00 committed by François
parent b231ebbc19
commit a6fde1059c
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View file

@ -574,9 +574,11 @@ pub(crate) fn get_meta_path(path: &Path) -> PathBuf {
meta_path
}
#[cfg(any(target_arch = "wasm32", target_os = "android"))]
/// A [`PathBuf`] [`Stream`] implementation that immediately returns nothing.
struct EmptyPathStream;
#[cfg(any(target_arch = "wasm32", target_os = "android"))]
impl Stream for EmptyPathStream {
type Item = PathBuf;

View file

@ -508,9 +508,9 @@ async fn load_gltf<'a, 'b, 'c>(
mesh.set_morph_targets(handle);
let extras = gltf_mesh.extras().as_ref();
if let Option::<MorphTargetNames>::Some(names) =
extras.and_then(|extras| serde_json::from_str(extras.get()).ok())
{
if let Some(names) = extras.and_then(|extras| {
serde_json::from_str::<MorphTargetNames>(extras.get()).ok()
}) {
mesh.set_morph_target_names(names.target_names);
}
}