diff options
author | Nadrieril | 2019-09-03 11:23:26 +0200 |
---|---|---|
committer | Nadrieril | 2019-09-03 11:23:26 +0200 |
commit | 468977575c68ac4cc3a57395ace4095db50e8947 (patch) | |
tree | 4bee3eb9ae523c313ffa683688a1bd9ee2ec78cb /dhall/src/phase | |
parent | a92d09259fc1db995a036eb2f22491c7024ca878 (diff) |
Upgrade rust toolchain
Diffstat (limited to '')
-rw-r--r-- | dhall/src/phase/binary.rs | 28 | ||||
-rw-r--r-- | dhall/src/phase/normalize.rs | 7 | ||||
-rw-r--r-- | dhall/src/phase/typecheck.rs | 8 |
3 files changed, 18 insertions, 25 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs index 40219d9..76d7ec9 100644 --- a/dhall/src/phase/binary.rs +++ b/dhall/src/phase/binary.rs @@ -52,7 +52,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { let l = Label::from(l.as_str()); Var(V(l, *n as usize)) } - [U64(0), f, args..] => { + [U64(0), f, args @ ..] => { if args.is_empty() { Err(DecodeError::WrongFormatError( "Function application must have at least one argument" @@ -126,7 +126,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { let t = cbor_value_to_dhall(&t)?; EmptyListLit(rc(App(rc(ExprF::Builtin(Builtin::List)), t))) } - [U64(4), Null, rest..] => { + [U64(4), Null, rest @ ..] => { let rest = rest .iter() .map(cbor_value_to_dhall) @@ -174,7 +174,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { let l = Label::from(l.as_str()); Field(x, l) } - [U64(10), x, rest..] => { + [U64(10), x, rest @ ..] => { let x = cbor_value_to_dhall(&x)?; let labels = rest .iter() @@ -203,7 +203,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { [U64(15), U64(x)] => NaturalLit(*x as Natural), [U64(16), U64(x)] => IntegerLit(*x as Integer), [U64(16), I64(x)] => IntegerLit(*x as Integer), - [U64(18), String(first), rest..] => { + [U64(18), String(first), rest @ ..] => { TextLit(InterpolatedText::from(( first.clone(), rest.iter() @@ -225,7 +225,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { let t = cbor_value_to_dhall(&t)?; Assert(t) } - [U64(24), hash, U64(mode), U64(scheme), rest..] => { + [U64(24), hash, U64(mode), U64(scheme), rest @ ..] => { let mode = match mode { 0 => ImportMode::Code, 1 => ImportMode::RawText, @@ -238,7 +238,9 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { let hash = match hash { Null => None, Bytes(bytes) => match bytes.as_slice() { - [18, 32, rest..] => Some(Hash::SHA256(rest.to_vec())), + [18, 32, rest @ ..] => { + Some(Hash::SHA256(rest.to_vec())) + } _ => Err(DecodeError::WrongFormatError(format!( "import/hash/unknown_multihash: {:?}", bytes @@ -334,7 +336,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> { location, }) } - [U64(25), bindings..] => { + [U64(25), bindings @ ..] => { let mut tuples = bindings.iter().tuples(); let bindings = (&mut tuples) .map(|(x, t, v)| { @@ -478,13 +480,9 @@ where BoolIf(x, y, z) => ser_seq!(ser; tag(14), expr(x), expr(y), expr(z)), Var(V(l, n)) if l == &"_".into() => ser.serialize_u64(*n as u64), Var(V(l, n)) => ser_seq!(ser; label(l), U64(*n as u64)), - Lam(l, x, y) if l == &"_".into() => { - ser_seq!(ser; tag(1), expr(x), expr(y)) - } + Lam(l, x, y) if l == &"_".into() => ser_seq!(ser; tag(1), expr(x), expr(y)), Lam(l, x, y) => ser_seq!(ser; tag(1), label(l), expr(x), expr(y)), - Pi(l, x, y) if l == &"_".into() => { - ser_seq!(ser; tag(2), expr(x), expr(y)) - } + Pi(l, x, y) if l == &"_".into() => ser_seq!(ser; tag(2), expr(x), expr(y)), Pi(l, x, y) => ser_seq!(ser; tag(2), label(l), expr(x), expr(y)), Let(_, _, _, _) => { let (bound_e, bindings) = collect_nested_lets(e); @@ -556,9 +554,7 @@ where ser_seq!(ser; tag(3), U64(op), expr(x), expr(y)) } Merge(x, y, None) => ser_seq!(ser; tag(6), expr(x), expr(y)), - Merge(x, y, Some(z)) => { - ser_seq!(ser; tag(6), expr(x), expr(y), expr(z)) - } + Merge(x, y, Some(z)) => ser_seq!(ser; tag(6), expr(x), expr(y), expr(z)), ToMap(x, None) => ser_seq!(ser; tag(27), expr(x)), ToMap(x, Some(y)) => ser_seq!(ser; tag(27), expr(x), expr(y)), Projection(x, ls) => ser.collect_seq( diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs index 3f6e99c..0992f74 100644 --- a/dhall/src/phase/normalize.rs +++ b/dhall/src/phase/normalize.rs @@ -290,7 +290,7 @@ pub(crate) fn apply_builtin( ) } }, - (ListFold, [_, l, _, cons, nil, r..]) => match &*l.as_whnf() { + (ListFold, [_, l, _, cons, nil, r @ ..]) => match &*l.as_whnf() { EmptyListLit(_) => Ret::ValueWithRemainingArgs(r, nil.clone()), NEListLit(xs) => { let mut v = nil.clone(); @@ -326,7 +326,8 @@ pub(crate) fn apply_builtin( ) } }, - (OptionalFold, [_, v, _, just, nothing, r..]) => match &*v.as_whnf() { + (OptionalFold, [_, v, _, just, nothing, r @ ..]) => match &*v.as_whnf() + { EmptyOptionalLit(_) => { Ret::ValueWithRemainingArgs(r, nothing.clone()) } @@ -356,7 +357,7 @@ pub(crate) fn apply_builtin( ), ), }, - (NaturalFold, [n, t, succ, zero, r..]) => match &*n.as_whnf() { + (NaturalFold, [n, t, succ, zero, r @ ..]) => match &*n.as_whnf() { NaturalLit(0) => Ret::ValueWithRemainingArgs(r, zero.clone()), NaturalLit(n) => { let fold = Value::from_builtin(NaturalFold) diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 9013c1f..2e61fbc 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -249,9 +249,7 @@ fn type_of_builtin<E>(b: Builtin) -> Expr<E> { list ), ListLength => make_type!(forall (a: Type) -> (List a) -> Natural), - ListHead | ListLast => { - make_type!(forall (a: Type) -> (List a) -> Optional a) - } + ListHead | ListLast => make_type!(forall (a: Type) -> (List a) -> Optional a), ListIndexed => make_type!( forall (a: Type) -> (List a) -> @@ -375,9 +373,7 @@ fn type_last_layer( Import(_) => unreachable!( "There should remain no imports in a resolved expression" ), - Lam(_, _, _) | Pi(_, _, _) | Let(_, _, _, _) | Embed(_) | Var(_) => { - unreachable!() - } + Lam(_, _, _) | Pi(_, _, _) | Let(_, _, _, _) | Embed(_) | Var(_) => unreachable!(), App(f, a) => { let tf = f.get_type()?; let tf_borrow = tf.as_whnf(); |