summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-qpack/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/neqo-qpack/src')
-rw-r--r--third_party/rust/neqo-qpack/src/decoder.rs4
-rw-r--r--third_party/rust/neqo-qpack/src/encoder.rs5
-rw-r--r--third_party/rust/neqo-qpack/src/huffman.rs6
-rw-r--r--third_party/rust/neqo-qpack/src/huffman_decode_helper.rs9
-rw-r--r--third_party/rust/neqo-qpack/src/lib.rs6
-rw-r--r--third_party/rust/neqo-qpack/src/qpack_send_buf.rs2
-rw-r--r--third_party/rust/neqo-qpack/src/reader.rs19
-rw-r--r--third_party/rust/neqo-qpack/src/table.rs2
8 files changed, 20 insertions, 33 deletions
diff --git a/third_party/rust/neqo-qpack/src/decoder.rs b/third_party/rust/neqo-qpack/src/decoder.rs
index 2119db0256..b2cfb6629a 100644
--- a/third_party/rust/neqo-qpack/src/decoder.rs
+++ b/third_party/rust/neqo-qpack/src/decoder.rs
@@ -4,8 +4,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::convert::TryFrom;
-
use neqo_common::{qdebug, Header};
use neqo_transport::{Connection, StreamId};
@@ -287,7 +285,7 @@ fn map_error(err: &Error) -> Error {
#[cfg(test)]
mod tests {
- use std::{convert::TryFrom, mem};
+ use std::mem;
use neqo_common::Header;
use neqo_transport::{StreamId, StreamType};
diff --git a/third_party/rust/neqo-qpack/src/encoder.rs b/third_party/rust/neqo-qpack/src/encoder.rs
index c7921ee2c0..c90570ccdc 100644
--- a/third_party/rust/neqo-qpack/src/encoder.rs
+++ b/third_party/rust/neqo-qpack/src/encoder.rs
@@ -4,10 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::{
- collections::{HashMap, HashSet, VecDeque},
- convert::TryFrom,
-};
+use std::collections::{HashMap, HashSet, VecDeque};
use neqo_common::{qdebug, qerror, qlog::NeqoQlog, qtrace, Header};
use neqo_transport::{Connection, Error as TransportError, StreamId};
diff --git a/third_party/rust/neqo-qpack/src/huffman.rs b/third_party/rust/neqo-qpack/src/huffman.rs
index 283a501b32..30bb880438 100644
--- a/third_party/rust/neqo-qpack/src/huffman.rs
+++ b/third_party/rust/neqo-qpack/src/huffman.rs
@@ -4,10 +4,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::convert::TryFrom;
-
use crate::{
- huffman_decode_helper::{HuffmanDecoderNode, HUFFMAN_DECODE_ROOT},
+ huffman_decode_helper::{huffman_decoder_root, HuffmanDecoderNode},
huffman_table::HUFFMAN_TABLE,
Error, Res,
};
@@ -93,7 +91,7 @@ pub fn decode_huffman(input: &[u8]) -> Res<Vec<u8>> {
}
fn decode_character(reader: &mut BitReader) -> Res<Option<u16>> {
- let mut node: &HuffmanDecoderNode = &HUFFMAN_DECODE_ROOT;
+ let mut node: &HuffmanDecoderNode = huffman_decoder_root();
let mut i = 0;
while node.value.is_none() {
match reader.read_bit() {
diff --git a/third_party/rust/neqo-qpack/src/huffman_decode_helper.rs b/third_party/rust/neqo-qpack/src/huffman_decode_helper.rs
index 122226dd1f..939312ab22 100644
--- a/third_party/rust/neqo-qpack/src/huffman_decode_helper.rs
+++ b/third_party/rust/neqo-qpack/src/huffman_decode_helper.rs
@@ -4,9 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::convert::TryFrom;
-
-use lazy_static::lazy_static;
+use std::sync::OnceLock;
use crate::huffman_table::HUFFMAN_TABLE;
@@ -15,8 +13,9 @@ pub struct HuffmanDecoderNode {
pub value: Option<u16>,
}
-lazy_static! {
- pub static ref HUFFMAN_DECODE_ROOT: HuffmanDecoderNode = make_huffman_tree(0, 0);
+pub fn huffman_decoder_root() -> &'static HuffmanDecoderNode {
+ static ROOT: OnceLock<HuffmanDecoderNode> = OnceLock::new();
+ ROOT.get_or_init(|| make_huffman_tree(0, 0))
}
fn make_huffman_tree(prefix: u32, len: u8) -> HuffmanDecoderNode {
diff --git a/third_party/rust/neqo-qpack/src/lib.rs b/third_party/rust/neqo-qpack/src/lib.rs
index 1581712017..10ee5df61c 100644
--- a/third_party/rust/neqo-qpack/src/lib.rs
+++ b/third_party/rust/neqo-qpack/src/lib.rs
@@ -4,11 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![cfg_attr(feature = "deny-warnings", deny(warnings))]
-#![warn(clippy::pedantic)]
-// This is because of Encoder and Decoder structs. TODO: think about a better namings for crate and
-// structs.
-#![allow(clippy::module_name_repetitions)]
+#![allow(clippy::module_name_repetitions)] // This lint doesn't work here.
pub mod decoder;
mod decoder_instructions;
diff --git a/third_party/rust/neqo-qpack/src/qpack_send_buf.rs b/third_party/rust/neqo-qpack/src/qpack_send_buf.rs
index a443859081..c0b8d7af1b 100644
--- a/third_party/rust/neqo-qpack/src/qpack_send_buf.rs
+++ b/third_party/rust/neqo-qpack/src/qpack_send_buf.rs
@@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::{convert::TryFrom, ops::Deref};
+use std::ops::Deref;
use neqo_common::Encoder;
diff --git a/third_party/rust/neqo-qpack/src/reader.rs b/third_party/rust/neqo-qpack/src/reader.rs
index ff9c42b246..0173ed7888 100644
--- a/third_party/rust/neqo-qpack/src/reader.rs
+++ b/third_party/rust/neqo-qpack/src/reader.rs
@@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::{convert::TryInto, mem, str};
+use std::{mem, str};
use neqo_common::{qdebug, qerror};
use neqo_transport::{Connection, StreamId};
@@ -223,20 +223,19 @@ impl IntReader {
}
}
-#[derive(Debug)]
+#[derive(Debug, Default)]
enum LiteralReaderState {
+ #[default]
ReadHuffman,
- ReadLength { reader: IntReader },
- ReadLiteral { offset: usize },
+ ReadLength {
+ reader: IntReader,
+ },
+ ReadLiteral {
+ offset: usize,
+ },
Done,
}
-impl Default for LiteralReaderState {
- fn default() -> Self {
- Self::ReadHuffman
- }
-}
-
/// This is decoder of a literal with a prefix:
/// 1) ignores `prefix_len` bits of the first byte,
/// 2) reads "huffman bit"
diff --git a/third_party/rust/neqo-qpack/src/table.rs b/third_party/rust/neqo-qpack/src/table.rs
index 7ce8572542..517e98db09 100644
--- a/third_party/rust/neqo-qpack/src/table.rs
+++ b/third_party/rust/neqo-qpack/src/table.rs
@@ -4,7 +4,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::{collections::VecDeque, convert::TryFrom};
+use std::collections::VecDeque;
use neqo_common::qtrace;