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.29
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Sep 15, 2018
1 parent caba55b commit 70f7721
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 26 deletions.
6 changes: 2 additions & 4 deletions src/build/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ pub trait Build {
.get(&Path::Job {
name: job_name,
configuration,
})?
.json()?)
})?.json()?)
} else {
Err(client::Error::InvalidUrl {
url: self.url().to_string(),
Expand All @@ -199,8 +198,7 @@ pub trait Build {
job_name,
number,
configuration,
})?
.text()?)
})?.text()?)
} else {
Err(client::Error::InvalidUrl {
url: self.url().to_string(),
Expand Down
3 changes: 1 addition & 2 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ impl Jenkins {
job_name: Name::Name(job_name.into().0),
number: build_number.into(),
configuration: None,
})?
.json()?)
})?.json()?)
}
}
3 changes: 1 addition & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ impl super::Jenkins {
.get_with_params(
&object.into(),
parameters.into().map(InternalAdvancedQueryParams::from),
)?
.json()?)
)?.json()?)
}
}
3 changes: 1 addition & 2 deletions src/client_internals/csrf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ mod tests {
"crumbRequestField":"Invalid-Crumb"
}
"#,
)
.create();
).create();

let crumb = jenkins_client.get_csrf();

Expand Down
12 changes: 10 additions & 2 deletions src/client_internals/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ pub enum Error {
},

/// Error thrown when CSRF protection use an unexpected field name
#[fail(display = "invalid crumbfield '{}', expected 'Jenkins-Crumb'", field_name)]
#[fail(
display = "invalid crumbfield '{}', expected 'Jenkins-Crumb'",
field_name
)]
InvalidCrumbFieldName {
/// Field name provided by Jenkins api for crumb
field_name: String,
Expand All @@ -37,7 +40,12 @@ pub enum Error {
UnsupportedBuildConfiguration,

/// Error when trying to do an action on an object not supporting it
#[fail(display = "can't do '{}' on a {} of type {}", action, object_type, variant_name)]
#[fail(
display = "can't do '{}' on a {} of type {}",
action,
object_type,
variant_name
)]
InvalidObjectType {
/// Object type
object_type: ExpectedType,
Expand Down
3 changes: 1 addition & 2 deletions src/job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ impl Jenkins {
.get(&Path::Job {
name: Name::Name(job_name.into().0),
configuration: None,
})?
.json()?)
})?.json()?)
// self.get_job_as(job_name, None)
}

Expand Down
16 changes: 13 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#![deny(
warnings, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
unused_qualifications, missing_docs, unused_extern_crates, unused_qualifications, unused_results
warnings,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications,
missing_docs,
unused_extern_crates,
unused_qualifications,
unused_results
)]

//! Bindings to [Jenkins JSON API](https://wiki.jenkins.io/display/JENKINS/Remote+access+API)
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/computer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ macro_rules! computer_with_common_fields_and_impl {
/// One off executors of the computer
pub one_off_executors: Vec<Executor>,

// TODO: actions, assignedLabels, loadStatistics
// TODO: actions, assignedLabels, loadStatistics

$(
$(#[$field_attr])*
Expand Down
6 changes: 2 additions & 4 deletions src/nodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ impl Jenkins {
Ok(self
.get(&Path::Computer {
name: Name::Name(&computer_name.into().0),
})?
.json()?)
})?.json()?)
}

/// Get the master `Computer`
pub fn get_master_node(&self) -> Result<computer::MasterComputer, Error> {
Ok(self
.get(&Path::Computer {
name: Name::Name("(master)"),
})?
.json()?)
})?.json()?)
}
}
3 changes: 1 addition & 2 deletions src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ impl Jenkins {
Ok(self
.get(&Path::View {
name: Name::Name(&view_name.into().0),
})?
.json()?)
})?.json()?)
}

/// Add the job `job_name` to the view `view_name`
Expand Down
3 changes: 1 addition & 2 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,7 @@ fn can_get_by_path_with_tree() {
.with_subfield("number")
.with_subfield("duration")
.with_subfield("result"),
)
.build(),
).build(),
);

assert!(r.is_ok());
Expand Down

0 comments on commit 70f7721

Please sign in to comment.