mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Don't .unwrap()
in AssetPath::try_parse
(#10452)
# Objective - The docs on `AssetPath::try_parse` say that it will return an error when the string is malformed, but it actually just `.unwrap()`s the result. ## Solution - Use `?` instead of unwrapping the result.
This commit is contained in:
parent
4667d80243
commit
26dfe42623
1 changed files with 1 additions and 1 deletions
|
@ -115,7 +115,7 @@ impl<'a> AssetPath<'a> {
|
|||
///
|
||||
/// This will return a [`ParseAssetPathError`] if `asset_path` is in an invalid format.
|
||||
pub fn try_parse(asset_path: &'a str) -> Result<AssetPath<'a>, ParseAssetPathError> {
|
||||
let (source, path, label) = Self::parse_internal(asset_path).unwrap();
|
||||
let (source, path, label) = Self::parse_internal(asset_path)?;
|
||||
Ok(Self {
|
||||
source: match source {
|
||||
Some(source) => AssetSourceId::Name(CowArc::Borrowed(source)),
|
||||
|
|
Loading…
Reference in a new issue