run 'cargo clippy --fix'

This commit is contained in:
Artturin 2022-11-01 22:15:26 +02:00
parent 261607a76d
commit 0db5ebd427
9 changed files with 17 additions and 18 deletions

View file

@ -182,7 +182,7 @@ impl Metric {
} }
fn events() -> Vec<MetricType> { fn events() -> Vec<MetricType> {
return vec![ vec![
Metric::ticker( Metric::ticker(
"StatCollectorLegacyEvent", "StatCollectorLegacyEvent",
"Number of received legacy events", "Number of received legacy events",
@ -346,7 +346,7 @@ fn events() -> Vec<MetricType> {
None None
), ),
*/ */
]; ]
} }
fn main() { fn main() {

View file

@ -64,14 +64,14 @@ pub fn parse_line(text: &str) -> Option<Vec<Instruction>> {
} }
} }
#[derive(PartialEq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub enum Instruction { pub enum Instruction {
Build(Subset, Vec<String>), Build(Subset, Vec<String>),
Eval, Eval,
} }
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum Subset { pub enum Subset {
Nixpkgs, Nixpkgs,
NixOS, NixOS,

View file

@ -8,7 +8,7 @@ pub struct IssueComment {
pub issue: Issue, pub issue: Issue,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum IssueCommentAction { pub enum IssueCommentAction {
Created, Created,

View file

@ -21,19 +21,19 @@ pub struct BaseChange {
pub sha: ChangeWas, pub sha: ChangeWas,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct ChangeWas { pub struct ChangeWas {
pub from: String, pub from: String,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum PullRequestState { pub enum PullRequestState {
Open, Open,
Closed, Closed,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum PullRequestAction { pub enum PullRequestAction {
Edited, Edited,

View file

@ -2,7 +2,7 @@ use crate::message::{Pr, Repo};
use hubcaps::checks::Conclusion; use hubcaps::checks::Conclusion;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub enum BuildStatus { pub enum BuildStatus {
Skipped, Skipped,
Success, Success,

View file

@ -14,7 +14,7 @@ use std::process::{Command, Stdio};
use tempfile::tempfile; use tempfile::tempfile;
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum File { pub enum File {
DefaultNixpkgs, DefaultNixpkgs,
ReleaseNixOS, ReleaseNixOS,
@ -95,7 +95,7 @@ impl fmt::Display for Operation {
} }
} }
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Nix { pub struct Nix {
pub system: String, pub system: String,
remote: String, remote: String,
@ -348,8 +348,7 @@ impl Nix {
fn lines_from_file(file: fs::File) -> Vec<String> { fn lines_from_file(file: fs::File) -> Vec<String> {
BufReader::new(file) BufReader::new(file)
.lines() .lines()
.filter(|line| line.is_ok()) .filter_map(|line| line.ok())
.map(|line| line.unwrap())
.filter(|msg| !is_user_setting_warning(msg)) .filter(|msg| !is_user_setting_warning(msg))
.collect() .collect()
} }

View file

@ -16,7 +16,7 @@ pub enum System {
X8664Linux, X8664Linux,
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct Stdenvs { pub struct Stdenvs {
nix: nix::Nix, nix: nix::Nix,
co: PathBuf, co: PathBuf,

View file

@ -91,10 +91,10 @@ impl worker::SimpleWorker for EvaluationFilterWorker {
pr: pr_msg, pr: pr_msg,
}; };
return vec![ vec![
worker::publish_serde_action(None, Some("mass-rebuild-check-jobs".to_owned()), &msg), worker::publish_serde_action(None, Some("mass-rebuild-check-jobs".to_owned()), &msg),
worker::Action::Ack, worker::Action::Ack,
]; ]
} }
} }

View file

@ -6,7 +6,7 @@ pub struct Response {}
pub type Actions = Vec<Action>; pub type Actions = Vec<Action>;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub enum Action { pub enum Action {
Ack, Ack,
NackRequeue, NackRequeue,
@ -14,7 +14,7 @@ pub enum Action {
Publish(Box<QueueMsg>), Publish(Box<QueueMsg>),
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct QueueMsg { pub struct QueueMsg {
pub exchange: Option<String>, pub exchange: Option<String>,
pub routing_key: Option<String>, pub routing_key: Option<String>,