Review comment: nits.

This commit is contained in:
Nick Alexander 2017-04-03 11:23:50 -07:00
parent 7135eeac49
commit f8e75d817e

View file

@ -9,7 +9,11 @@
// specific language governing permissions and limitations under the License. // specific language governing permissions and limitations under the License.
use std; use std;
use std::fmt::{Display, Formatter}; use std::fmt::{
Debug,
Display,
Formatter,
};
use std::cmp::Ordering; use std::cmp::Ordering;
use combine::{ use combine::{
@ -25,7 +29,7 @@ use combine::{
satisfy, satisfy,
satisfy_map, satisfy_map,
}; };
use combine::primitives; // To not shadow Error use combine::primitives; // To not shadow Error.
use combine::primitives::{ use combine::primitives::{
Consumed, Consumed,
FastResult, FastResult,
@ -40,12 +44,12 @@ use combine::combinator::{
use edn; use edn;
/// A wrapper to let us order `edn::Span` in whatever way is appropriate for parsing with `combine`. /// A wrapper to let us order `edn::Span` in whatever way is appropriate for parsing with `combine`.
#[derive(Clone, Debug)] #[derive(Clone, Copy, Debug)]
pub struct SpanPosition(edn::Span); pub struct SpanPosition(edn::Span);
impl Display for SpanPosition { impl Display for SpanPosition {
fn fmt(&self, f: &mut Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut Formatter) -> ::std::fmt::Result {
write!(f, "{:?}", self.0) self.0.fmt(f)
} }
} }
@ -292,9 +296,9 @@ pub fn value(value: edn::Value) -> Box<Parser<Input=Stream, Output=edn::ValueAnd
satisfy(move |v: edn::ValueAndSpan| value == v.inner.into()).boxed() satisfy(move |v: edn::ValueAndSpan| value == v.inner.into()).boxed()
} }
pub fn keyword_map_(input: Stream) -> ParseResult<edn::ValueAndSpan, Stream> fn keyword_map_(input: Stream) -> ParseResult<edn::ValueAndSpan, Stream>
{ {
// One run is a keyword followed by at one or more non-keywords. // One run is a keyword followed by one or more non-keywords.
let run = (satisfy(|v: edn::ValueAndSpan| v.inner.is_keyword()), let run = (satisfy(|v: edn::ValueAndSpan| v.inner.is_keyword()),
many1(satisfy(|v: edn::ValueAndSpan| !v.inner.is_keyword())) many1(satisfy(|v: edn::ValueAndSpan| !v.inner.is_keyword()))
.map(|vs: Vec<edn::ValueAndSpan>| { .map(|vs: Vec<edn::ValueAndSpan>| {