Skip to content

Commit

Permalink
Ensure string library is availble in no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Nov 4, 2024
1 parent 8b78848 commit b4954e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion musicxml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
#[macro_use]
extern crate alloc;

use alloc::string::String;
use alloc::{string::String, vec::Vec};

/// Contains the main data types used by the MusicXML format.
///
Expand Down
2 changes: 1 addition & 1 deletion musicxml/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn get_musicxml_contents(data: Vec<u8>) -> Result<String, String> {
Err(String::from("Cannot find MusicXML file in compressed archive"))?;
}
} else {
contents = String::from_utf8(data).map_err(|e| e.to_string())?;
contents = String::from_utf8(data).or_else(|_| Err(String::from("Invalid UTF-8 data in MusicXML content")))?;
}
Ok(contents)
}
Expand Down

0 comments on commit b4954e0

Please sign in to comment.