Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
🎨 update format for rust 1.28
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Aug 10, 2018
1 parent dd1831c commit 4e3c736
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 28 deletions.
11 changes: 6 additions & 5 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ impl Jenkins {
J: Into<JobName<'a>>,
B: Into<BuildNumber>,
{
Ok(self.get(&Path::Build {
job_name: Name::Name(job_name.into().0),
number: build_number.into(),
configuration: None,
})?
Ok(self
.get(&Path::Build {
job_name: Name::Name(job_name.into().0),
number: build_number.into(),
configuration: None,
})?
.json()?)
}
}
9 changes: 5 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ impl super::Jenkins {
Q: Into<Option<AdvancedQuery>>,
for<'de> T: serde::Deserialize<'de>,
{
Ok(self.get_with_params(
&object.into(),
parameters.into().map(InternalAdvancedQueryParams::from),
)?
Ok(self
.get_with_params(
&object.into(),
parameters.into().map(InternalAdvancedQueryParams::from),
)?
.json()?)
}
}
3 changes: 2 additions & 1 deletion src/client_internals/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ impl Jenkins {
} else {
url
};
let slashes: Vec<usize> = path.char_indices()
let slashes: Vec<usize> = path
.char_indices()
.filter(|c| c.1 == '/')
.map(|c| c.0)
.collect();
Expand Down
3 changes: 2 additions & 1 deletion src/client_internals/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ impl ToString for TreeQueryParam {
.collect::<Vec<_>>()
.join(",")
),
(None, _) => self.subkeys
(None, _) => self
.subkeys
.iter()
.map(TreeQueryParam::to_string)
.collect::<Vec<_>>()
Expand Down
9 changes: 5 additions & 4 deletions src/job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ impl Jenkins {
where
J: Into<JobName<'a>>,
{
Ok(self.get(&Path::Job {
name: Name::Name(job_name.into().0),
configuration: None,
})?
Ok(self
.get(&Path::Job {
name: Name::Name(job_name.into().0),
configuration: None,
})?
.json()?)
// self.get_job_as(job_name, None)
}
Expand Down
14 changes: 8 additions & 6 deletions src/nodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ impl Jenkins {
where
C: Into<computer::ComputerName<'a>>,
{
Ok(self.get(&Path::Computer {
name: Name::Name(&computer_name.into().0),
})?
Ok(self
.get(&Path::Computer {
name: Name::Name(&computer_name.into().0),
})?
.json()?)
}

/// Get the master `Computer`
pub fn get_master_node(&self) -> Result<computer::MasterComputer, Error> {
Ok(self.get(&Path::Computer {
name: Name::Name("(master)"),
})?
Ok(self
.get(&Path::Computer {
name: Name::Name("(master)"),
})?
.json()?)
}
}
7 changes: 4 additions & 3 deletions src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ impl Jenkins {
where
V: Into<ViewName<'a>>,
{
Ok(self.get(&Path::View {
name: Name::Name(&view_name.into().0),
})?
Ok(self
.get(&Path::View {
name: Name::Name(&view_name.into().0),
})?
.json()?)
}

Expand Down
12 changes: 8 additions & 4 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ fn can_get_build_from_job_and_back() {
.unwrap();
let job = jenkins.get_job("normal job");
assert_that!(job).is_ok();
let job_variant = job.unwrap()
let job_variant = job
.unwrap()
.as_variant::<jenkins_api::job::FreeStyleProject>();
assert_that!(job_variant).is_ok();
let job_ok = job_variant.unwrap();
Expand Down Expand Up @@ -335,7 +336,8 @@ fn can_get_queue_item() {

let job = jenkins.get_job("job name");
assert!(job.is_ok());
let triggered = job.unwrap()
let triggered = job
.unwrap()
.as_variant::<jenkins_api::job::FreeStyleProject>()
.unwrap()
.build(&jenkins);
Expand Down Expand Up @@ -579,7 +581,8 @@ fn can_poll_scm() {
let job = jenkins.get_job("git triggered");
assert!(job.is_ok());

let poll = job.unwrap()
let poll = job
.unwrap()
.as_variant::<jenkins_api::job::FreeStyleProject>()
.unwrap()
.poll_scm(&jenkins);
Expand All @@ -599,7 +602,8 @@ fn can_get_maven_job() {
let job = jenkins.get_job("maven job");
assert_that!(job).named("getting a job").is_ok();

let maven_project = job.unwrap()
let maven_project = job
.unwrap()
.as_variant::<jenkins_api::job::MavenModuleSet>();
assert_that!(maven_project)
.named("was able to get as a MavenModuleSet")
Expand Down

0 comments on commit 4e3c736

Please sign in to comment.