Skip to content

Commit

Permalink
refactor: cleanup new unused warnings (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Apr 2, 2024
1 parent 3a79832 commit 5b6c9e0
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 27 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ jobs:
run: ./ci/h2spec.sh
if: matrix.rust == 'stable'

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
#clippy_check:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Run Clippy
# run: cargo clippy --all-targets --all-features

msrv:
name: Check MSRV
Expand Down
2 changes: 2 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1631,9 +1631,11 @@ impl proto::Peer for Peer {
proto::DynPeer::Client
}

/*
fn is_server() -> bool {
false
}
*/

fn convert_poll_message(
pseudo: Pseudo,
Expand Down
2 changes: 0 additions & 2 deletions src/frame/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,6 @@ fn decoded_header_size(name: usize, value: usize) -> usize {
mod test {
use std::iter::FromIterator;

use http::HeaderValue;

use super::*;
use crate::frame;
use crate::hpack::{huffman, Encoder};
Expand Down
1 change: 0 additions & 1 deletion src/hpack/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ pub fn get_static(idx: usize) -> Header {
#[cfg(test)]
mod test {
use super::*;
use crate::hpack::Header;

#[test]
fn test_peek_u8() {
Expand Down
1 change: 0 additions & 1 deletion src/hpack/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ fn position(buf: &BytesMut) -> usize {
#[cfg(test)]
mod test {
use super::*;
use crate::hpack::Header;
use http::*;

#[test]
Expand Down
6 changes: 3 additions & 3 deletions src/proto/connection.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use crate::codec::UserError;
use crate::frame::{Reason, StreamId};
use crate::{client, frame, server};
use crate::{client, server};

use crate::frame::DEFAULT_INITIAL_WINDOW_SIZE;
use crate::proto::*;

use bytes::{Buf, Bytes};
use bytes::Bytes;
use futures_core::Stream;
use std::io;
use std::marker::PhantomData;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Duration;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::io::AsyncRead;

/// An H2 connection
#[derive(Debug)]
Expand Down
4 changes: 3 additions & 1 deletion src/proto/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ pub(crate) trait Peer {

fn r#dyn() -> Dyn;

fn is_server() -> bool;
//fn is_server() -> bool;

fn convert_poll_message(
pseudo: Pseudo,
fields: HeaderMap,
stream_id: StreamId,
) -> Result<Self::Poll, Error>;

/*
fn is_local_init(id: StreamId) -> bool {
assert!(!id.is_zero());
Self::is_server() == id.is_server_initiated()
}
*/
}

/// A dynamic representation of `Peer`.
Expand Down
1 change: 0 additions & 1 deletion src/proto/settings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::codec::UserError;
use crate::error::Reason;
use crate::frame;
use crate::proto::*;
use std::task::{Context, Poll};

Expand Down
4 changes: 2 additions & 2 deletions src/proto/streams/prioritize.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::store::Resolve;
use super::*;

use crate::frame::{Reason, StreamId};
use crate::frame::Reason;

use crate::codec::UserError;
use crate::codec::UserError::*;

use bytes::buf::{Buf, Take};
use bytes::buf::Take;
use std::{
cmp::{self, Ordering},
fmt, io, mem,
Expand Down
6 changes: 3 additions & 3 deletions src/proto/streams/recv.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use super::*;
use crate::codec::UserError;
use crate::frame::{self, PushPromiseHeaderError, Reason, DEFAULT_INITIAL_WINDOW_SIZE};
use crate::proto::{self, Error};
use crate::frame::{PushPromiseHeaderError, Reason, DEFAULT_INITIAL_WINDOW_SIZE};
use crate::proto;

use http::{HeaderMap, Request, Response};

use std::cmp::Ordering;
use std::io;
use std::task::{Context, Poll, Waker};
use std::time::{Duration, Instant};
use std::time::Instant;

#[derive(Debug)]
pub(super) struct Recv {
Expand Down
2 changes: 2 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,9 +1501,11 @@ impl proto::Peer for Peer {

const NAME: &'static str = "Server";

/*
fn is_server() -> bool {
true
}
*/

fn r#dyn() -> proto::DynPeer {
proto::DynPeer::Server
Expand Down
2 changes: 1 addition & 1 deletion tests/h2-support/src/frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::convert::TryInto;
use std::fmt;

use bytes::Bytes;
use http::{self, HeaderMap, StatusCode};
use http::{HeaderMap, StatusCode};

use h2::{
ext::Protocol,
Expand Down
2 changes: 1 addition & 1 deletion tests/h2-support/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::SendFrame;

use h2::frame::{self, Frame};
use h2::proto::Error;
use h2::{self, SendError};
use h2::SendError;

use futures::future::poll_fn;
use futures::{ready, Stream, StreamExt};
Expand Down
2 changes: 0 additions & 2 deletions tests/h2-support/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use h2;

use bytes::{BufMut, Bytes};
use futures::ready;
use std::future::Future;
Expand Down
1 change: 0 additions & 1 deletion tests/h2-tests/tests/hammer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{
atomic::{AtomicUsize, Ordering},
Arc,
},
thread,
};
use tokio::net::{TcpListener, TcpStream};

Expand Down
2 changes: 1 addition & 1 deletion tests/h2-tests/tests/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![deny(warnings)]

use futures::future::{join, poll_fn};
use futures::future::join;
use futures::StreamExt;
use h2_support::prelude::*;
use tokio::io::AsyncWriteExt;
Expand Down
2 changes: 1 addition & 1 deletion tests/h2-tests/tests/stream_states.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![deny(warnings)]

use futures::future::{join, join3, lazy, poll_fn, try_join};
use futures::future::{join, join3, lazy, try_join};
use futures::{FutureExt, StreamExt, TryStreamExt};
use h2_support::prelude::*;
use h2_support::util::yield_once;
Expand Down

0 comments on commit 5b6c9e0

Please sign in to comment.