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 GitHub
parent 3452781bf7
commit c994c15d5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -680,9 +680,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

@ -511,9 +511,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);
}
}