mirror of
https://github.com/tonarino/innernet.git
synced 2024-11-28 08:58:37 +02:00
Fix clippy warnings, add clippy to CI (#127)
* Tidy code a bit thanks to clippy Clippy 1.54 newly detects some redundant constructs, that's nice. sort_unstable() should yield exact same results as sort() for `Vec<&str>` and could be faster, clippy says. * Add clippy to CI
This commit is contained in:
parent
e97eb737a4
commit
eb90cc53a5
5
.github/workflows/rust.yml
vendored
5
.github/workflows/rust.yml
vendored
@ -47,3 +47,8 @@ jobs:
|
||||
with:
|
||||
command: test
|
||||
args: --verbose
|
||||
- name: Clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -- -D warnings
|
||||
|
@ -510,7 +510,7 @@ fn fetch(
|
||||
if peers.iter().any(|p| p.public_key == public_key) {
|
||||
None
|
||||
} else {
|
||||
PeerDiff::new(Some(&existing), None).unwrap()
|
||||
PeerDiff::new(Some(existing), None).unwrap()
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -162,7 +162,7 @@ mod tests {
|
||||
let whole_body = hyper::body::aggregate(res).await?;
|
||||
let State { peers, .. } = serde_json::from_reader(whole_body.reader())?;
|
||||
let mut peer_names = peers.iter().map(|p| &*p.contents.name).collect::<Vec<_>>();
|
||||
peer_names.sort();
|
||||
peer_names.sort_unstable();
|
||||
// Developers should see only peers in infra CIDR and developer CIDR.
|
||||
assert_eq!(
|
||||
&["developer1", "developer2", "innernet-server"],
|
||||
@ -284,7 +284,7 @@ mod tests {
|
||||
let whole_body = hyper::body::aggregate(res).await?;
|
||||
let State { peers, .. } = serde_json::from_reader(whole_body.reader())?;
|
||||
let mut peer_names = peers.iter().map(|p| &*p.contents.name).collect::<Vec<_>>();
|
||||
peer_names.sort();
|
||||
peer_names.sort_unstable();
|
||||
// Developers should see only peers in infra CIDR and developer CIDR.
|
||||
assert_eq!(
|
||||
&[
|
||||
|
@ -134,7 +134,7 @@ impl Server {
|
||||
pub fn context(&self) -> Context {
|
||||
Context {
|
||||
db: self.db.clone(),
|
||||
interface: self.interface.clone(),
|
||||
interface: self.interface,
|
||||
endpoints: self.endpoints.clone(),
|
||||
public_key: self.public_key.clone(),
|
||||
#[cfg(target_os = "linux")]
|
||||
|
@ -511,7 +511,7 @@ impl<'a> PeerDiff<'a> {
|
||||
}
|
||||
|
||||
pub fn public_key(&self) -> &Key {
|
||||
&self.builder.public_key()
|
||||
self.builder.public_key()
|
||||
}
|
||||
|
||||
pub fn changes(&self) -> &[ChangeString] {
|
||||
|
Loading…
Reference in New Issue
Block a user