Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 7090e2a1eeb31d5a1536a489698a60fd2547323d
parent d5fec97fcb2eb20df3be6a59b529289535d28263
Author: Sergio Benitez <sb@sergio.bz>
Date:   Mon, 29 Oct 2018 01:32:52 -0700

Use 'unreachable' to silence clippy on route codegen.

Closes #794.

Diffstat:
Mcore/codegen/Cargo.toml | 2+-
Mcore/codegen/src/attribute/route.rs | 8+++++---
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/core/codegen/Cargo.toml b/core/codegen/Cargo.toml @@ -32,4 +32,4 @@ rev = "62f361f" [dev-dependencies] rocket = { version = "0.4.0-dev", path = "../lib" } -compiletest_rs = { version = "0.3", features = ["stable"] } +compiletest_rs = { git = "https://github.com/laumann/compiletest-rs" } diff --git a/core/codegen/src/attribute/route.rs b/core/codegen/src/attribute/route.rs @@ -180,9 +180,11 @@ fn data_expr(ident: &syn::Ident, ty: &syn::Type) -> TokenStream2 { Owned(Outcome::Success(__v)) => Owned(Outcome::Success(__v)), Borrowed(Outcome::Success(ref __v)) => { Borrowed(Outcome::Success(::std::borrow::Borrow::borrow(__v))) - } - Borrowed(__o) => Borrowed(__o.map(|_| loop { /* unreachable */ })), - Owned(__o) => Owned(__o) + }, + Borrowed(__o) => Borrowed(__o.map(|_| { + unreachable!("Borrowed(Success(..)) case handled in previous block") + })), + Owned(__o) => Owned(__o), }; #[allow(non_snake_case, unreachable_patterns, unreachable_code)]