Unverified Commit 5b9d0c0f authored by Zelda Hessler's avatar Zelda Hessler Committed by GitHub
Browse files

fix clippy lints from the future (#3438)

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Because the build pipeline is checking for these.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent 07c8074c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -104,14 +104,17 @@ mod tests {
    use bytes::Buf;
    use bytes_utils::SegmentedBuf;
    use http_body::Body;
    use std::fmt::Write;
    use std::io::Read;

    fn header_value_as_checksum_string(header_value: &http::HeaderValue) -> String {
        let decoded_checksum = base64::decode(header_value.to_str().unwrap()).unwrap();
        let decoded_checksum = decoded_checksum
            .into_iter()
            .map(|byte| format!("{:02X?}", byte))
            .collect::<String>();
            .fold(String::new(), |mut acc, byte| {
                write!(acc, "{byte:02X?}").expect("string will always be writeable");
                acc
            });

        format!("0x{}", decoded_checksum)
    }
+5 −2
Original line number Diff line number Diff line
@@ -304,6 +304,7 @@ mod tests {
    use aws_smithy_types::base64;
    use http::HeaderValue;
    use pretty_assertions::assert_eq;
    use std::fmt::Write;

    const TEST_DATA: &str = r#"test data"#;

@@ -311,8 +312,10 @@ mod tests {
        let decoded_checksum = base64::decode(header_value.to_str().unwrap()).unwrap();
        let decoded_checksum = decoded_checksum
            .into_iter()
            .map(|byte| format!("{:02X?}", byte))
            .collect::<String>();
            .fold(String::new(), |mut acc, byte| {
                write!(acc, "{byte:02X?}").expect("string will always be writeable");
                acc
            });

        format!("0x{}", decoded_checksum)
    }
+1 −3
Original line number Diff line number Diff line
@@ -499,9 +499,7 @@ event_loop.add_signal_handler(signal.SIGINT,
}

fn addr_incoming_from_socket(socket: Socket) -> AddrIncoming {
    let std_listener: StdTcpListener = socket
        .try_into()
        .expect("unable to convert `socket2::Socket` into `std::net::TcpListener`");
    let std_listener: StdTcpListener = socket.into();
    // StdTcpListener::from_std doesn't set O_NONBLOCK
    std_listener
        .set_nonblocking(true)
+1 −4
Original line number Diff line number Diff line
@@ -110,10 +110,7 @@ impl<S> FromIterator<(String, S)> for AwsJsonRouter<S> {
    #[inline]
    fn from_iter<T: IntoIterator<Item = (String, S)>>(iter: T) -> Self {
        Self {
            routes: iter
                .into_iter()
                .map(|(svc, request_spec)| (svc, request_spec))
                .collect(),
            routes: iter.into_iter().collect(),
        }
    }
}
+3 −12
Original line number Diff line number Diff line
@@ -95,10 +95,7 @@ where
impl<S> FromIterator<(RequestSpec, S)> for RestRouter<S> {
    #[inline]
    fn from_iter<T: IntoIterator<Item = (RequestSpec, S)>>(iter: T) -> Self {
        let mut routes: Vec<(RequestSpec, S)> = iter
            .into_iter()
            .map(|(request_spec, svc)| (request_spec, svc))
            .collect();
        let mut routes: Vec<(RequestSpec, S)> = iter.into_iter().collect();

        // Sort them once by specificity, with the more specific routes sorted before the less
        // specific ones, so that when routing a request we can simply iterate through the routes
@@ -167,10 +164,7 @@ mod tests {
        ];

        // Test both RestJson1 and RestXml routers.
        let router: RestRouter<_> = request_specs
            .into_iter()
            .map(|(spec, svc_name)| (spec, svc_name))
            .collect();
        let router: RestRouter<_> = request_specs.into_iter().collect();

        let hits = vec![
            ("A", Method::GET, "/a/b/c"),
@@ -255,10 +249,7 @@ mod tests {
            ),
        ];

        let router: RestRouter<_> = request_specs
            .into_iter()
            .map(|(spec, svc_name)| (spec, svc_name))
            .collect();
        let router: RestRouter<_> = request_specs.into_iter().collect();

        let hits = vec![
            ("A1", Method::GET, "/a/foo"),
Loading