Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jeckersb committed May 8, 2023
1 parent abb58c1 commit b4b2ab8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 15 additions & 13 deletions src/v2/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ pub struct Config {
}

impl Config {
/// Initialize `Config` with default values.
pub fn default() -> Self {
Self {
index: "registry-1.docker.io".into(),
insecure_registry: false,
accept_invalid_certs: false,
accepted_types: None,
user_agent: Some(crate::USER_AGENT.to_owned()),
username: None,
password: None,
}
}

/// Set registry service to use (vhost or IP).
pub fn registry(mut self, reg: &str) -> Self {
self.index = reg.to_owned();
Expand Down Expand Up @@ -135,3 +122,18 @@ impl Config {
Ok(c)
}
}

impl Default for Config {
/// Initialize `Config` with default values.
fn default() -> Self {
Self {
index: "registry-1.docker.io".into(),
insecure_registry: false,
accept_invalid_certs: false,
accepted_types: None,
user_agent: Some(crate::USER_AGENT.to_owned()),
username: None,
password: None,
}
}
}
2 changes: 1 addition & 1 deletion src/v2/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn parse_link(hdr: Option<&header::HeaderValue>) -> Option<String> {

// Query parameters for next page URL.
let uri = sval.trim_end_matches(">; rel=\"next\"");
let query: Vec<&str> = uri.splitn(2, "?").collect();
let query: Vec<&str> = uri.splitn(2, '?').collect();
match query.get(1) { //use the entire query param string since some registries have different ways of pagination
Some(v) if !v.is_empty() => Some(v.to_string()),
_ => None,
Expand Down

0 comments on commit b4b2ab8

Please sign in to comment.