Commit b70ebb2
authored
Remove unused parts of
## Objective
`AssetLoaders::find` maps from various properties to an asset loader:
```rust
fn find(
&self,
type_name: Option<&str>,
asset_type_id: Option<TypeId>,
extension: Option<&str>,
asset_path: Option<&AssetPath<'_>>,
) -> Option<MaybeAssetLoader> {
```
But in practice the `type_name` and `extension` parameters are always
`None`, and the `asset_path` parameter is always `Some`.
## Solution
This PR removes the unused parts:
```diff
fn find(
&self,
- type_name: Option<&str>,
asset_type_id: Option<TypeId>,
- extension: Option<&str>,
- asset_path: Option<&AssetPath<'_>>,
+ asset_path: &AssetPath<'_>,
) -> Option<MaybeAssetLoader> {
```
`AssetLoaders::find` is `pub(crate)`, so this should not affect users.
I looked back at the [original
PR](#11644) and couldn't spot any
cases where these parameters were ever used. I'm not sure if that's an
oversight or if they were intended for future use.
I also made matching changes to `AssetLoaderError::MissingAssetLoaders`.
This is `pub` so technically should have a migration guide. I'm not
entirely convinced that's necessary for such a trivial change, but happy
to add one if requested.
```diff
MissingAssetLoader {
- loader_name: Option<String>,
asset_type_id: Option<TypeId>,
- extension: Option<String>,
- asset_path: Option<String>,
+ asset_path: String,
},
```
## Testing
```sh
cargo test -p bevy_asset
cargo run --example asset_loading
cargo run --example asset_processing --features="file_watcher asset_processor"
```AssetLoaders::find (#23703)1 parent 5d03586 commit b70ebb2
2 files changed
Lines changed: 23 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | 157 | | |
159 | | - | |
160 | | - | |
| 158 | + | |
161 | 159 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 160 | | |
168 | | - | |
| 161 | + | |
169 | 162 | | |
170 | 163 | | |
171 | 164 | | |
| |||
207 | 200 | | |
208 | 201 | | |
209 | 202 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 203 | | |
218 | | - | |
| 204 | + | |
219 | 205 | | |
220 | 206 | | |
221 | 207 | | |
| |||
236 | 222 | | |
237 | 223 | | |
238 | 224 | | |
239 | | - | |
240 | | - | |
| 225 | + | |
| 226 | + | |
241 | 227 | | |
242 | 228 | | |
243 | 229 | | |
244 | 230 | | |
245 | 231 | | |
246 | | - | |
247 | | - | |
| 232 | + | |
| 233 | + | |
248 | 234 | | |
249 | 235 | | |
250 | 236 | | |
| |||
597 | 583 | | |
598 | 584 | | |
599 | 585 | | |
600 | | - | |
601 | 586 | | |
602 | | - | |
603 | | - | |
| 587 | + | |
604 | 588 | | |
605 | 589 | | |
606 | 590 | | |
| |||
618 | 602 | | |
619 | 603 | | |
620 | 604 | | |
621 | | - | |
622 | 605 | | |
623 | | - | |
624 | | - | |
| 606 | + | |
625 | 607 | | |
626 | 608 | | |
627 | 609 | | |
| |||
639 | 621 | | |
640 | 622 | | |
641 | 623 | | |
642 | | - | |
643 | 624 | | |
644 | | - | |
645 | | - | |
| 625 | + | |
646 | 626 | | |
647 | 627 | | |
648 | 628 | | |
| |||
662 | 642 | | |
663 | 643 | | |
664 | 644 | | |
665 | | - | |
666 | 645 | | |
667 | | - | |
668 | | - | |
| 646 | + | |
669 | 647 | | |
670 | 648 | | |
671 | 649 | | |
| |||
683 | 661 | | |
684 | 662 | | |
685 | 663 | | |
686 | | - | |
687 | 664 | | |
688 | | - | |
689 | | - | |
| 665 | + | |
690 | 666 | | |
691 | 667 | | |
692 | 668 | | |
| |||
706 | 682 | | |
707 | 683 | | |
708 | 684 | | |
709 | | - | |
710 | 685 | | |
711 | | - | |
712 | | - | |
| 686 | + | |
713 | 687 | | |
714 | 688 | | |
715 | 689 | | |
| |||
727 | 701 | | |
728 | 702 | | |
729 | 703 | | |
730 | | - | |
731 | 704 | | |
732 | | - | |
733 | | - | |
| 705 | + | |
734 | 706 | | |
735 | 707 | | |
736 | 708 | | |
| |||
766 | 738 | | |
767 | 739 | | |
768 | 740 | | |
769 | | - | |
770 | 741 | | |
771 | | - | |
772 | | - | |
| 742 | + | |
773 | 743 | | |
774 | 744 | | |
775 | 745 | | |
| |||
785 | 755 | | |
786 | 756 | | |
787 | 757 | | |
788 | | - | |
789 | 758 | | |
790 | | - | |
791 | | - | |
| 759 | + | |
792 | 760 | | |
793 | 761 | | |
794 | 762 | | |
| |||
804 | 772 | | |
805 | 773 | | |
806 | 774 | | |
807 | | - | |
808 | 775 | | |
809 | | - | |
810 | | - | |
| 776 | + | |
811 | 777 | | |
812 | 778 | | |
813 | 779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1615 | 1615 | | |
1616 | 1616 | | |
1617 | 1617 | | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
| 1618 | + | |
1622 | 1619 | | |
1623 | 1620 | | |
1624 | | - | |
1625 | 1621 | | |
1626 | | - | |
1627 | | - | |
| 1622 | + | |
1628 | 1623 | | |
1629 | 1624 | | |
1630 | 1625 | | |
| |||
1635 | 1630 | | |
1636 | 1631 | | |
1637 | 1632 | | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
| 1633 | + | |
1642 | 1634 | | |
1643 | 1635 | | |
1644 | | - | |
1645 | 1636 | | |
1646 | | - | |
1647 | | - | |
| 1637 | + | |
1648 | 1638 | | |
1649 | 1639 | | |
1650 | 1640 | | |
| |||
2375 | 2365 | | |
2376 | 2366 | | |
2377 | 2367 | | |
2378 | | - | |
| 2368 | + | |
2379 | 2369 | | |
2380 | | - | |
2381 | 2370 | | |
2382 | | - | |
2383 | | - | |
| 2371 | + | |
2384 | 2372 | | |
2385 | 2373 | | |
2386 | 2374 | | |
| |||
0 commit comments