Skip to content

Commit

Permalink
Use Err instead of panic
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxxuanran committed Jun 4, 2024
1 parent 0a1b3c4 commit b6c61d0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/biliup/src/uploader/bilibili.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ impl FromStr for Vid {
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
let s = s.trim();
if s.len() < 3 {
if s.parse::<i32>().is_err() {
panic!("Invalid input")
}
return s.parse::<u64>().map(|val| Vid::Aid(val)).map_err(|e| e);
}
match &s[..2] {
"BV" => Ok(Vid::Bvid(s.to_string())),
Expand Down

0 comments on commit b6c61d0

Please sign in to comment.