clippy: eliminate redundant field definitions

This commit is contained in:
Graham Christensen 2019-01-01 20:51:10 -05:00
parent ecc49cf75d
commit 9b9941f7e6
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
19 changed files with 62 additions and 62 deletions

View file

@ -14,9 +14,9 @@ impl ACL {
trusted_users.iter_mut().map(|x| *x = x.to_lowercase()).last();
known_users.iter_mut().map(|x| *x = x.to_lowercase()).last();
return ACL {
trusted_users: trusted_users,
known_users: known_users,
repos: repos,
trusted_users,
known_users,
repos,
};
}

View file

@ -41,7 +41,7 @@ impl CachedCloner {
return CachedProject {
root: new_root,
clone_url: clone_url,
clone_url,
};
}
}
@ -55,7 +55,7 @@ impl CachedProject {
return Ok(CachedProjectCo {
root: new_root,
id: id,
id,
clone_url: self.clone_from().clone(),
local_reference: self.clone_to().clone(),
});

View file

@ -20,10 +20,10 @@ impl<'a> CommitStatus<'a> {
url: Option<String>,
) -> CommitStatus<'a> {
let mut stat = CommitStatus {
api: api,
sha: sha,
context: context,
description: description,
api,
sha,
context,
description,
url: "".to_owned(),
};

View file

@ -304,8 +304,8 @@ pub fn session_from_config(config: &RabbitMQConfig) -> Result<amqp::Session, amq
vhost: config.virtualhost.clone().unwrap_or("/".to_owned()),
login: config.username.clone(),
password: config.password.clone(),
scheme: scheme,
properties: properties,
scheme,
properties,
..amqp::Options::default()
};

View file

@ -16,9 +16,9 @@ impl EvalChecker {
pub fn new(name: &str, op: nix::Operation, args: Vec<String>, nix: nix::Nix) -> EvalChecker {
EvalChecker {
name: name.to_owned(),
op: op,
args: args,
nix: nix,
op,
args,
nix,
}
}

View file

@ -35,15 +35,15 @@ impl BuildJob {
).to_lowercase();
BuildJob {
repo: repo,
pr: pr,
repo,
pr,
subset: Some(subset),
attrs: attrs,
attrs,
logs: Some(logs.unwrap_or((Some("logs".to_owned()), Some(logbackrk)))),
statusreport: Some(statusreport.unwrap_or(
(Some("build-results".to_owned()), None),
)),
request_id: request_id,
request_id,
}
}
}

View file

@ -76,10 +76,10 @@ pub struct Nix {
impl Nix {
pub fn new(system: String, remote: String, build_timeout: u16, initial_heap_size: Option<String>) -> Nix {
return Nix {
system: system,
remote: remote,
build_timeout: build_timeout,
initial_heap_size: initial_heap_size,
system,
remote,
build_timeout,
initial_heap_size,
limit_supported_systems: true,
};
}

View file

@ -49,8 +49,8 @@ pub struct ChannelNotificationReceiver<'a> {
impl<'a> ChannelNotificationReceiver<'a> {
pub fn new(channel: &'a mut Channel, delivery_tag: u64) -> ChannelNotificationReceiver<'a> {
return ChannelNotificationReceiver {
channel: channel,
delivery_tag: delivery_tag,
channel,
delivery_tag,
};
}
}

View file

@ -122,9 +122,9 @@ pub struct OutPaths {
impl OutPaths {
pub fn new(nix: nix::Nix, path: PathBuf, check_meta: bool) -> OutPaths {
OutPaths {
nix: nix,
path: path,
check_meta: check_meta,
nix,
path,
check_meta,
}
}

View file

@ -29,7 +29,7 @@ pub struct RabbitMQ {
impl RabbitMQ {
pub fn new(identity: &str, channel: Channel) -> RabbitMQ {
RabbitMQ { identity: identity.to_owned(), channel: channel }
RabbitMQ { identity: identity.to_owned(), channel, }
}
}

View file

@ -32,10 +32,10 @@ impl BuildWorker {
identity: String,
) -> BuildWorker {
return BuildWorker {
cloner: cloner,
nix: nix,
system: system,
identity: identity,
cloner,
nix,
system,
identity,
};
}
@ -83,15 +83,15 @@ impl<'a, 'b> JobActions<'a, 'b> {
return JobActions {
system: system.to_owned(),
identity: identity.to_owned(),
receiver: receiver,
job: job,
receiver,
job,
line_counter: 0,
snippet_log: VecDeque::with_capacity(10),
attempt_id: format!("{}", Uuid::new_v4()),
log_exchange: log_exchange,
log_routing_key: log_routing_key,
result_exchange: result_exchange,
result_routing_key: result_routing_key,
log_exchange,
log_routing_key,
result_exchange,
result_routing_key,
};
}
@ -241,7 +241,7 @@ impl<'a, 'b> JobActions<'a, 'b> {
output: self.log_snippet(),
attempt_id: self.attempt_id.clone(),
request_id: self.job.request_id.clone(),
status: status,
status,
attempted_attrs: Some(attempted_attrs),
skipped_attrs: Some(not_attempted_attrs),
};
@ -496,7 +496,7 @@ mod tests {
let job = buildjob::BuildJob {
attrs: vec!["success".to_owned()],
pr: Pr {
head_sha: head_sha,
head_sha,
number: 1,
target_branch: Some("master".to_owned()),
},
@ -545,7 +545,7 @@ mod tests {
let job = buildjob::BuildJob {
attrs: vec!["not-real".to_owned()],
pr: Pr {
head_sha: head_sha,
head_sha,
number: 1,
target_branch: Some("master".to_owned()),
},

View file

@ -29,8 +29,8 @@ pub struct Stdenvs {
impl Stdenvs {
pub fn new(nix: nix::Nix, co: PathBuf) -> Stdenvs {
return Stdenvs {
nix: nix,
co: co,
nix,
co,
linux_stdenv_before: None,
linux_stdenv_after: None,

View file

@ -17,7 +17,7 @@ pub struct EvaluationFilterWorker {
impl EvaluationFilterWorker {
pub fn new(acl: acl::ACL) -> EvaluationFilterWorker {
return EvaluationFilterWorker {
acl: acl,
acl,
};
}
}

View file

@ -22,8 +22,8 @@ pub struct GitHubCommentWorker {
impl GitHubCommentWorker {
pub fn new(acl: acl::ACL, github: hubcaps::Github) -> GitHubCommentWorker {
return GitHubCommentWorker {
acl: acl,
github: github,
acl,
github,
};
}
}

View file

@ -17,7 +17,7 @@ pub struct GitHubCommentPoster {
impl GitHubCommentPoster {
pub fn new(github: hubcaps::Github) -> GitHubCommentPoster {
return GitHubCommentPoster { github: github };
return GitHubCommentPoster { github };
}
}

View file

@ -62,7 +62,7 @@ impl LogMessageCollector {
pub fn new(log_root: PathBuf, max_open: usize) -> LogMessageCollector {
return LogMessageCollector {
handles: LruCache::new(max_open),
log_root: log_root,
log_root,
};
}
@ -215,9 +215,9 @@ impl worker::SimpleWorker for LogMessageCollector {
return Ok(LogMessage {
from: LogFrom {
routing_key: deliver.routing_key.clone(),
attempt_id: attempt_id,
attempt_id,
},
message: message
message,
});
}

View file

@ -46,13 +46,13 @@ impl<E: stats::SysEvents> MassRebuildWorker<E> {
tag_paths: HashMap<String, Vec<String>>,
) -> MassRebuildWorker<E> {
return MassRebuildWorker {
cloner: cloner,
cloner,
nix: nix.without_limited_supported_systems(),
github: github,
acl: acl,
identity: identity,
events: events,
tag_paths: tag_paths
github,
acl,
identity,
events,
tag_paths,
};
}
@ -609,9 +609,9 @@ fn make_gist<'a>(
return Some(
gists
.create(&hubcaps::gists::GistOptions {
description: description,
description,
public: Some(true),
files: files,
files,
})
.expect("Failed to create gist!")
.html_url,

View file

@ -14,8 +14,8 @@ pub struct StatCollectorWorker<E> {
impl<E: stats::SysEvents + 'static> StatCollectorWorker<E> {
pub fn new(events: E, collector: stats::MetricCollector) -> StatCollectorWorker<E> {
StatCollectorWorker {
events: events,
collector: collector,
events,
collector,
}
}
}

View file

@ -45,8 +45,8 @@ where
};
return Action::Publish(QueueMsg {
exchange: exchange,
routing_key: routing_key,
exchange,
routing_key,
mandatory: false,
immediate: false,
properties: Some(props),