Showing the changes to git-object/src (3 of 4 files). Show all
Unified · Split
| @@ -12,8 +12,8 @@ pub use tag::Tag; · 11 unmodified lines | ||
| 12 | 12 | quick_error! { |
| 13 | 13 | #[derive(Debug)] |
| 14 | 14 | pub enum Error { |
| 15 | − ParseIntegerError(msg: &'static str, kind: Vec<u8>, err: btoi::ParseIntegerError) { | |
| 16 | − display("{}: {:?}", msg, std::str::from_utf8(&kind)) | |
| 15 | + ParseIntegerError(msg: &'static str, kind: bstr::BString, err: btoi::ParseIntegerError) { | |
| 16 | + display("{}: {:?}", msg, kind) | |
| 17 | 17 | cause(err) |
| 18 | 18 | } |
| 19 | 19 | Nom(err_msg: String) { |
| @@ -34,14 +34,14 @@ pub(crate) fn parse_signature(i: &[u8]) -> IResult<&[u8], Signature, Error> { · 33 unmodified lines | ||
| 34 | 34 | let hours = btoi::<i32>(&tzhour).map_err(|e| { |
| 35 | 35 | nom::Err::Error(Error::ParseIntegerError( |
| 36 | 36 | "invalid 'hours' string", |
| 37 | − tzhour.to_owned(), | |
| 37 | + tzhour.into(), | |
| 38 | 38 | e, |
| 39 | 39 | )) |
| 40 | 40 | })?; |
| 41 | 41 | let minutes = btoi::<i32>(&tzminute).map_err(|e| { |
| 42 | 42 | nom::Err::Error(Error::ParseIntegerError( |
| 43 | 43 | "invalid 'minutes' string", |
| 44 | − tzminute.to_owned(), | |
| 44 | + tzminute.into(), | |
| 45 | 45 | e, |
| 46 | 46 | )) |
| 47 | 47 | })?; |
| @@ -56,7 +56,7 @@ pub(crate) fn parse_signature(i: &[u8]) -> IResult<&[u8], Signature, Error> { · 8 unmodified lines | ||
| 56 | 56 | time: btoi::<u32>(time_in_seconds).map_err(|e| { |
| 57 | 57 | nom::Err::Error(Error::ParseIntegerError( |
| 58 | 58 | "Could parse to seconds", |
| 59 | − time_in_seconds.to_owned(), | |
| 59 | + time_in_seconds.into(), | |
| 60 | 60 | e, |
| 61 | 61 | )) |
| 62 | 62 | })?, |
| @@ -37,7 +37,7 @@ pub enum Kind { · 36 unmodified lines | ||
| 37 | 37 | quick_error! { |
| 38 | 38 | #[derive(Debug)] |
| 39 | 39 | pub enum Error { |
| 40 | − InvalidObjectKind(kind: Vec<u8>) { | |
| 40 | + InvalidObjectKind(kind: bstr::BString) { | |
| 41 | 41 | display("Unknown object kind: {:?}", std::str::from_utf8(&kind)) |
| 42 | 42 | } |
| 43 | 43 | } |
| @@ -50,7 +50,7 @@ impl Kind { · 6 unmodified lines | ||
| 50 | 50 | b"commit" => Kind::Commit, |
| 51 | 51 | b"tree" => Kind::Tree, |
| 52 | 52 | b"blob" => Kind::Blob, |
| 53 | − _ => return Err(Error::InvalidObjectKind(s.to_owned())), | |
| 53 | + _ => return Err(Error::InvalidObjectKind(s.into())), | |
| 54 | 54 | }) |
| 55 | 55 | } |
| 56 | 56 | } |