Skip to content

Commit

Permalink
Edition 2018 (#121)
Browse files Browse the repository at this point in the history
* Edition 2018

* Fix unused const on aarch64

* Fix Edition 2018 for SIMD
  • Loading branch information
kornelski committed Aug 30, 2022
1 parent 0e1e0b0 commit a68d7f9
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 136 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation = "https://docs.rs/httparse"
readme = "README.md"
keywords = ["http", "parser", "no_std"]
categories = ["network-programming", "no-std", "parser-implementations", "web-programming"]

edition = "2018"
build = "build.rs"

[features]
Expand Down
10 changes: 4 additions & 6 deletions benches/parse.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
extern crate criterion;
extern crate httparse;

use std::time::Duration;

use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};

const REQ_SHORT: &'static [u8] = b"\
const REQ_SHORT: &[u8] = b"\
GET / HTTP/1.0\r\n\
Host: example.com\r\n\
Cookie: session=60; user_id=1\r\n\r\n";

const REQ: &'static [u8] = b"\
const REQ: &[u8] = b"\
GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n\
Host: www.kittyhell.com\r\n\
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\n\
Expand Down Expand Up @@ -44,13 +42,13 @@ fn req_short(c: &mut Criterion) {
}));
}

const RESP_SHORT: &'static [u8] = b"\
const RESP_SHORT: &[u8] = b"\
HTTP/1.0 200 OK\r\n\
Date: Wed, 21 Oct 2015 07:28:00 GMT\r\n\
Set-Cookie: session=60; user_id=1\r\n\r\n";

// These particular headers don't all make semantic sense for a response, but they're syntactically valid.
const RESP: &'static [u8] = b"\
const RESP: &[u8] = b"\
HTTP/1.1 200 OK\r\n\
Date: Wed, 21 Oct 2015 07:28:00 GMT\r\n\
Host: www.kittyhell.com\r\n\
Expand Down
2 changes: 1 addition & 1 deletion src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> Bytes<'a> {

#[inline]
pub fn peek_ahead(&self, n: usize) -> Option<u8> {
self.slice.get(self.pos + n).cloned()
self.slice.get(self.pos + n).copied()
}

#[inline]
Expand Down

0 comments on commit a68d7f9

Please sign in to comment.