mirror of
https://gitee.com/openharmony/third_party_rust_nom
synced 2024-11-23 07:29:54 +00:00
always install rusfmt
run rustfmt on stable
This commit is contained in:
parent
7c8fdd87b9
commit
87eabf9049
@ -29,7 +29,7 @@ matrix:
|
||||
env: DOC_FEATURES='--features "std regexp regexp_macros" --no-default-features'
|
||||
before_script:
|
||||
- export PATH=$HOME/.cargo/bin:$PATH
|
||||
- which rustfmt || rustup component add rustfmt-preview
|
||||
- rustup component add rustfmt-preview
|
||||
script:
|
||||
- eval cargo fmt -- --write-mode=diff
|
||||
- eval cargo doc --verbose $DOC_FEATURES
|
||||
|
16
src/types.rs
16
src/types.rs
@ -292,7 +292,7 @@ impl<'a> super::util::HexDisplay for CompleteByteSlice<'a> {
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
||||
pub struct Input<T> {
|
||||
pub inner: T,
|
||||
pub inner: T,
|
||||
pub at_eof: bool,
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ impl<T> AtEof for Input<T> {
|
||||
impl<T: Slice<Range<usize>>> Slice<Range<usize>> for Input<T> {
|
||||
fn slice(&self, range: Range<usize>) -> Self {
|
||||
Input {
|
||||
inner: self.inner.slice(range),
|
||||
inner: self.inner.slice(range),
|
||||
at_eof: self.at_eof,
|
||||
}
|
||||
}
|
||||
@ -314,7 +314,7 @@ impl<T: Slice<Range<usize>>> Slice<Range<usize>> for Input<T> {
|
||||
impl<T: Slice<RangeTo<usize>>> Slice<RangeTo<usize>> for Input<T> {
|
||||
fn slice(&self, range: RangeTo<usize>) -> Self {
|
||||
Input {
|
||||
inner: self.inner.slice(range),
|
||||
inner: self.inner.slice(range),
|
||||
at_eof: self.at_eof,
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ impl<T: Slice<RangeTo<usize>>> Slice<RangeTo<usize>> for Input<T> {
|
||||
impl<T: Slice<RangeFrom<usize>>> Slice<RangeFrom<usize>> for Input<T> {
|
||||
fn slice(&self, range: RangeFrom<usize>) -> Self {
|
||||
Input {
|
||||
inner: self.inner.slice(range),
|
||||
inner: self.inner.slice(range),
|
||||
at_eof: self.at_eof,
|
||||
}
|
||||
}
|
||||
@ -332,7 +332,7 @@ impl<T: Slice<RangeFrom<usize>>> Slice<RangeFrom<usize>> for Input<T> {
|
||||
impl<T: Slice<RangeFull>> Slice<RangeFull> for Input<T> {
|
||||
fn slice(&self, range: RangeFull) -> Self {
|
||||
Input {
|
||||
inner: self.inner.slice(range),
|
||||
inner: self.inner.slice(range),
|
||||
at_eof: self.at_eof,
|
||||
}
|
||||
}
|
||||
@ -364,7 +364,7 @@ impl<T: InputIter> InputIter for Input<T> {
|
||||
impl<T: InputTake> InputTake for Input<T> {
|
||||
fn take(&self, count: usize) -> Self {
|
||||
Input {
|
||||
inner: self.inner.take(count),
|
||||
inner: self.inner.take(count),
|
||||
at_eof: self.at_eof,
|
||||
}
|
||||
}
|
||||
@ -373,11 +373,11 @@ impl<T: InputTake> InputTake for Input<T> {
|
||||
let (left, right) = self.inner.take_split(count);
|
||||
(
|
||||
Input {
|
||||
inner: left,
|
||||
inner: left,
|
||||
at_eof: self.at_eof,
|
||||
},
|
||||
Input {
|
||||
inner: right,
|
||||
inner: right,
|
||||
at_eof: self.at_eof,
|
||||
},
|
||||
)
|
||||
|
@ -3,9 +3,9 @@ extern crate nom;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Color {
|
||||
pub red: u8,
|
||||
pub red: u8,
|
||||
pub green: u8,
|
||||
pub blue: u8,
|
||||
pub blue: u8,
|
||||
}
|
||||
|
||||
fn from_hex(input: &str) -> Result<u8, std::num::ParseIntError> {
|
||||
@ -38,9 +38,9 @@ fn parse_color() {
|
||||
Ok((
|
||||
"",
|
||||
Color {
|
||||
red: 47,
|
||||
red: 47,
|
||||
green: 20,
|
||||
blue: 223,
|
||||
blue: 223,
|
||||
}
|
||||
))
|
||||
);
|
||||
|
@ -11,7 +11,7 @@ use nom::types::CompleteByteSlice;
|
||||
#[allow(dead_code)]
|
||||
struct Range {
|
||||
start: char,
|
||||
end: char,
|
||||
end: char,
|
||||
}
|
||||
|
||||
pub fn take_char(input: &[u8]) -> IResult<&[u8], char> {
|
||||
|
@ -239,7 +239,7 @@ enum MP4BoxType {
|
||||
#[derive(Debug)]
|
||||
struct MP4BoxHeader {
|
||||
length: u32,
|
||||
tag: MP4BoxType,
|
||||
tag: MP4BoxType,
|
||||
}
|
||||
|
||||
named!(brand_name<&[u8],&str>, map_res!(take!(4), str::from_utf8));
|
||||
|
Loading…
Reference in New Issue
Block a user