Skip to content

chore(volo-http): refactor websocket (#503) #1335

chore(volo-http): refactor websocket (#503)

chore(volo-http): refactor websocket (#503) #1335

GitHub Actions / clippy succeeded Sep 26, 2024 in 0s

clippy

26 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 26
Note 0
Help 0

Versions

  • rustc 1.83.0-nightly (9e394f551 2024-09-25)
  • cargo 1.83.0-nightly (eaee77dc1 2024-09-19)
  • clippy 0.1.83 (9e394f5 2024-09-25)

Annotations

Check warning on line 407 in examples/src/http/example-http-server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> examples/src/http/example-http-server.rs:407:46
    |
407 |     Server::new(app).run(addr).await.unwrap();
    |                                              ^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
407 |     Server::new(app).run(addr).await.unwrap()Server::new(app).run(addr).await.unwrap();
    |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 123 in examples/src/http/example-http-client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> examples/src/http/example-http-client.rs:123:7
    |
123 |     Ok(())
    |       ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
123 |     OkOk(())
    |       ~~~~~~

Check warning on line 118 in examples/src/grpc/streaming/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> examples/src/grpc/streaming/server.rs:118:18
    |
118 |         .unwrap();
    |                  ^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
118 ~         .unwrap()Server::new()
119 +         .add_service(
120 +             ServiceBuilder::new(volo_gen::proto_gen::streaming::StreamingServer::new(S)).build(),
121 +         )
122 +         .run(addr)
123 +         .await
124 +         .unwrap();
    |

Check warning on line 19 in examples/src/grpc/streaming/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/streaming/client.rs:19:36
   |
19 |     bidirectional_streaming().await;
   |                                    ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
19 |     bidirectional_streaming().awaitbidirectional_streaming().await;
   |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 38 in examples/src/grpc/multiplex/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/multiplex/client.rs:35:16
   |
35 |       match resp {
   |  ________________^
36 | |         Ok(info) => println!("ECHO: {info:?}"),
37 | |         Err(e) => eprintln!("ECHO: {e:?}"),
38 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
35 ~     match resp match resp {
36 +         Ok(info) => println!("ECHO: {info:?}"),
37 +         Err(e) => eprintln!("ECHO: {e:?}"),
38 +     }
   |

Check warning on line 78 in examples/src/grpc/loadbalance/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/loadbalance/client.rs:78:15
   |
78 |         .await;
   |               ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
78 ~         .awaitMETAINFO
79 +         .scope(RefCell::new(mi), async move {
80 +             for _ in 0..3 {
81 +                 let req = volo_gen::proto_gen::helloworld::HelloRequest {
82 +                     name: FastStr::from_static_str("Volo"),
83 +                 };
84 +                 set_request_hash(ip_to_u64(&get_local_ip().unwrap()));
85 +                 let resp = CLIENT.say_hello(req).await;
86 +                 match resp {
87 +                     Ok(info) => println!("{info:?}"),
88 +                     Err(e) => eprintln!("{e:?}"),
89 +                 }
90 +             }
91 +             for _ in 0..3 {
92 +                 let req = volo_gen::proto_gen::helloworld::HelloRequest {
93 +                     name: FastStr::from_static_str("Volo"),
94 +                 };
95 +                 set_request_hash(1000);
96 +                 let resp = CLIENT.clone().say_hello(req).await;
97 +                 match resp {
98 +                     Ok(info) => println!("{info:?}"),
99 +                     Err(e) => eprintln!("{e:?}"),
100+                 }
101+             }
102+         })
103+         .await;
   |

Check warning on line 43 in examples/src/thrift/multiplex/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/multiplex/client.rs:43:34
   |
43 |     future::pending::<()>().await;
   |                                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
43 ~     future::pending::<()>().awaitfor i in 0..resps.capacity() {
44 +         resps.push(tokio::spawn(futs(i)));
45 +     }
46 + 
47 +     for resp in resps {
48 +         let _ = resp.await;
49 +     }
50 +     future::pending::<()>().await;
   |

Check warning on line 33 in examples/src/grpc/compression/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/compression/client.rs:30:16
   |
30 |       match resp {
   |  ________________^
31 | |         Ok(info) => println!("{info:?}"),
32 | |         Err(e) => eprintln!("{e:?}"),
33 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
30 ~     match resp match resp {
31 +         Ok(info) => println!("{info:?}"),
32 +         Err(e) => eprintln!("{e:?}"),
33 +     }
   |

Check warning on line 45 in examples/src/grpc/compression/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/compression/server.rs:45:18
   |
45 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
45 ~         .unwrap()Server::new()
46 +         .add_service(
47 +             ServiceBuilder::new(volo_gen::proto_gen::helloworld::GreeterServer::new(S))
48 +                 .send_compressions(vec![
49 +                     Zlib(Some(ZlibConfig {
50 +                         level: Level::fast(),
51 +                     })),
52 +                     Gzip(Some(GzipConfig::default())),
53 +                 ])
54 +                 .accept_compressions(vec![Gzip(None), Zlib(None), Identity])
55 +                 .build(),
56 +         )
57 +         .run(addr)
58 +         .await
59 +         .unwrap();
   |

Check warning on line 31 in examples/src/thrift/multiplex/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/multiplex/server.rs:31:18
   |
31 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
31 ~         .unwrap()volo_gen::thrift_gen::hello::HelloServiceServer::new(S)
32 +         .multiplex(true)
33 +         .run(addr)
34 +         .await
35 +         .unwrap();
   |

Check warning on line 47 in examples/src/grpc/multiplex/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/multiplex/server.rs:47:18
   |
47 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
47 ~         .unwrap()Server::new()
48 +         .add_service(
49 +             ServiceBuilder::new(volo_gen::proto_gen::helloworld::GreeterServer::new(G)).build(),
50 +         )
51 +         .add_service(ServiceBuilder::new(volo_gen::proto_gen::echo::EchoServer::new(E)).build())
52 +         .run(addr)
53 +         .await
54 +         .unwrap();
   |

Check warning on line 28 in examples/src/thrift/unknown/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/unknown/server.rs:28:18
   |
28 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
28 ~         .unwrap()volo_gen::thrift_gen::echo_unknown::EchoServiceServer::new(S)
29 +         .run(addr)
30 +         .await
31 +         .unwrap();
   |

Check warning on line 21 in examples/src/grpc/hello/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/hello/client.rs:18:16
   |
18 |       match resp {
   |  ________________^
19 | |         Ok(info) => println!("{info:?}"),
20 | |         Err(e) => eprintln!("{e:?}"),
21 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
18 ~     match resp match resp {
19 +         Ok(info) => println!("{info:?}"),
20 +         Err(e) => eprintln!("{e:?}"),
21 +     }
   |

Check warning on line 26 in examples/src/thrift/hello/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/hello/server.rs:26:18
   |
26 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
26 ~         .unwrap()volo_gen::thrift_gen::hello::HelloServiceServer::new(S)
27 +         .run(addr)
28 +         .await
29 +         .unwrap();
   |

Check warning on line 26 in examples/src/thrift/hello/server_panic.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/hello/server_panic.rs:26:18
   |
26 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
26 ~         .unwrap()volo_gen::thrift_gen::hello::HelloServiceServer::new(S)
27 +         .layer_front(volo::catch_panic::Layer::new(log_and_return_exception))
28 +         .run(addr)
29 +         .await
30 +         .unwrap();
   |

Check warning on line 64 in examples/src/grpc/loadbalance/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/loadbalance/server.rs:64:25
   |
64 |     println!("shutdown");
   |                         ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
64 |     println!("shutdown")println!("shutdown");
   |                         ~~~~~~~~~~~~~~~~~~~~~

Check warning on line 32 in examples/src/thrift/unknown/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/unknown/client.rs:29:16
   |
29 |       match resp {
   |  ________________^
30 | |         Ok(info) => println!("{info:?}"),
31 | |         Err(e) => eprintln!("{e:?}"),
32 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
29 ~     match resp match resp {
30 +         Ok(info) => println!("{info:?}"),
31 +         Err(e) => eprintln!("{e:?}"),
32 +     }
   |

Check warning on line 36 in examples/src/grpc/grpc-web/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/grpc-web/server.rs:36:18
   |
36 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
36 ~         .unwrap()Server::new()
37 +         .accept_http1(true)
38 +         .layer_tower(GrpcWebLayer::new())
39 +         .add_service(
40 +             ServiceBuilder::new(volo_gen::proto_gen::helloworld::GreeterServer::new(S)).build(),
41 +         )
42 +         .run(addr)
43 +         .await
44 +         .unwrap();
   |

Check warning on line 36 in examples/src/grpc/grpc-web/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/grpc-web/client.rs:36:52
   |
36 |     assert_eq!(&trailers[..], b"grpc-status:0\r\n");
   |                                                    ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
36 |     assert_eq!(&trailers[..], b"grpc-status:0\r\n")assert_eq!(&trailers[..], b"grpc-status:0\r\n");
   |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 31 in examples/src/grpc/hello/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/grpc/hello/server.rs:31:18
   |
31 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
31 ~         .unwrap()Server::new()
32 +         .add_service(
33 +             ServiceBuilder::new(volo_gen::proto_gen::helloworld::GreeterServer::new(S)).build(),
34 +         )
35 +         .run(addr)
36 +         .await
37 +         .unwrap();
   |

Check warning on line 25 in examples/src/thrift/hello/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> examples/src/thrift/hello/client.rs:22:16
   |
22 |       match resp {
   |  ________________^
23 | |         Ok(info) => println!("{info:?}"),
24 | |         Err(e) => eprintln!("{e:?}"),
25 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
22 ~     match resp match resp {
23 +         Ok(info) => println!("{info:?}"),
24 +         Err(e) => eprintln!("{e:?}"),
25 +     }
   |

Check warning on line 172 in volo-grpc/src/status.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty line after doc comment

warning: empty line after doc comment
   --> volo-grpc/src/status.rs:171:5
    |
171 | /     /// Create a new [`Status`] with the associated code and message.
172 | |
    | |_
173 |       pub fn new(code: Code, message: impl Into<String>) -> Self {
    |       ---------------------------------------------------------- the comment documents this associated function
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
    = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
    = help: if the empty line is unintentional remove it

Check warning on line 97 in benchmark/src/bin/client.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> benchmark/src/bin/client.rs:97:21
   |
97 |     recoder.report();
   |                     ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
97 |     recoder.report()recoder.report();
   |                     ~~~~~~~~~~~~~~~~~

Check warning on line 34 in benchmark/src/bin/server.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> benchmark/src/bin/server.rs:34:18
   |
34 |         .unwrap();
   |                  ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
34 ~         .unwrap()benchmark::benchmark::echo::EchoServerServer::new(S)
35 +         .run(addr)
36 +         .await
37 +         .unwrap();
   |

Check warning on line 62 in benchmark/src/perf/mem.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting to the same type is unnecessary (`u64` -> `u64`)

warning: casting to the same type is unnecessary (`u64` -> `u64`)
  --> benchmark/src/perf/mem.rs:62:41
   |
62 |                     mem_usage_list.push(mem_usage as u64);
   |                                         ^^^^^^^^^^^^^^^^ help: try: `mem_usage`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
   = note: `#[warn(clippy::unnecessary_cast)]` on by default