Add fixes made by cargo clippy
This commit is contained in:
parent
c07e3f57ea
commit
6fa97f2e4a
@ -116,7 +116,7 @@ impl Chart {
|
|||||||
}
|
}
|
||||||
//let err = error!("repo {} is not found in the repo list", self.repository);
|
//let err = error!("repo {} is not found in the repo list", self.repository);
|
||||||
let error_msg = format!("repo {} is not found in the repo list", self.repository);
|
let error_msg = format!("repo {} is not found in the repo list", self.repository);
|
||||||
return Err(Box::from(error_msg));
|
Err(Box::from(error_msg))
|
||||||
}
|
}
|
||||||
// TODO: Handle the "mirror not found" error
|
// TODO: Handle the "mirror not found" error
|
||||||
pub(crate) fn populate_mirrors(
|
pub(crate) fn populate_mirrors(
|
||||||
@ -132,7 +132,7 @@ impl Chart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mirror_objs.len() > 0 {
|
if !mirror_objs.is_empty() {
|
||||||
self.mirror_objs = Some(mirror_objs);
|
self.mirror_objs = Some(mirror_objs);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -143,7 +143,7 @@ impl Chart {
|
|||||||
Some(res) => res.helm.unwrap().url,
|
Some(res) => res.helm.unwrap().url,
|
||||||
None => {
|
None => {
|
||||||
warn!("repository object is not filled for chart {}", self.name);
|
warn!("repository object is not filled for chart {}", self.name);
|
||||||
return "".to_string();
|
"".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ impl Chart {
|
|||||||
Some(res) => res.git.unwrap().url,
|
Some(res) => res.git.unwrap().url,
|
||||||
None => {
|
None => {
|
||||||
warn!("repository object is not filled for chart {}", self.name);
|
warn!("repository object is not filled for chart {}", self.name);
|
||||||
return "".to_string();
|
"".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ impl Chart {
|
|||||||
Some(res) => res.git.unwrap().git_ref,
|
Some(res) => res.git.unwrap().git_ref,
|
||||||
None => {
|
None => {
|
||||||
warn!("repository object is not filled for chart {}", self.name);
|
warn!("repository object is not filled for chart {}", self.name);
|
||||||
return "".to_string();
|
"".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ impl Chart {
|
|||||||
Some(res) => res.git.unwrap().path,
|
Some(res) => res.git.unwrap().path,
|
||||||
None => {
|
None => {
|
||||||
warn!("repository object is not filled for chart {}", self.name);
|
warn!("repository object is not filled for chart {}", self.name);
|
||||||
return "".to_string();
|
"".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ impl Chart {
|
|||||||
match &self.repository_obj {
|
match &self.repository_obj {
|
||||||
Some(res) => {
|
Some(res) => {
|
||||||
if res.helm.is_some() {
|
if res.helm.is_some() {
|
||||||
return Ok(RepositoryKind::Helm);
|
Ok(RepositoryKind::Helm)
|
||||||
} else if res.git.is_some() {
|
} else if res.git.is_some() {
|
||||||
return Ok(RepositoryKind::Git);
|
return Ok(RepositoryKind::Git);
|
||||||
} else {
|
} else {
|
||||||
@ -190,9 +190,9 @@ impl Chart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
return Err(Box::from(
|
Err(Box::from(
|
||||||
"repository object is not filled up for the chart",
|
"repository object is not filled up for the chart",
|
||||||
));
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,12 +172,12 @@ fn patch_action_from_definition(
|
|||||||
patch: Patch,
|
patch: Patch,
|
||||||
) -> Result<Box<dyn PatchInterface>, Box<dyn std::error::Error>> {
|
) -> Result<Box<dyn PatchInterface>, Box<dyn std::error::Error>> {
|
||||||
if let Some(regexp) = patch.regexp {
|
if let Some(regexp) = patch.regexp {
|
||||||
return Ok(Box::new(RegexpPatch { path: regexp.path }));
|
Ok(Box::new(RegexpPatch { path: regexp.path }))
|
||||||
} else if let Some(git) = patch.git {
|
} else if let Some(git) = patch.git {
|
||||||
return Ok(Box::new(GitPatch {
|
return Ok(Box::new(GitPatch {
|
||||||
path: {
|
path: {
|
||||||
let path = PathBuf::from(git.path);
|
let path = PathBuf::from(git.path);
|
||||||
let can_path = fs::canonicalize(&path).ok().unwrap();
|
let can_path = fs::canonicalize(path).ok().unwrap();
|
||||||
can_path.into_os_string().into_string().ok().unwrap()
|
can_path.into_os_string().into_string().ok().unwrap()
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
@ -192,7 +192,7 @@ fn patch_action_from_definition(
|
|||||||
return Ok(Box::from(yq));
|
return Ok(Box::from(yq));
|
||||||
} else {
|
} else {
|
||||||
return Err(Box::from("unknown patch type"));
|
return Err(Box::from("unknown patch type"));
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_git_repo(path: String) -> bool {
|
fn is_git_repo(path: String) -> bool {
|
||||||
|
@ -44,7 +44,7 @@ fn main() {
|
|||||||
Some(res) => match create_dir(res.clone()) {
|
Some(res) => match create_dir(res.clone()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let path = PathBuf::from(res);
|
let path = PathBuf::from(res);
|
||||||
let can_path = fs::canonicalize(&path).ok().unwrap();
|
let can_path = fs::canonicalize(path).ok().unwrap();
|
||||||
can_path.into_os_string().into_string().ok().unwrap()
|
can_path.into_os_string().into_string().ok().unwrap()
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -37,7 +37,7 @@ pub(crate) struct Version {
|
|||||||
pub(crate) fn repo_from_chart(chart: Chart) -> Result<Box<dyn Repo>, Box<dyn std::error::Error>> {
|
pub(crate) fn repo_from_chart(chart: Chart) -> Result<Box<dyn Repo>, Box<dyn std::error::Error>> {
|
||||||
match chart.get_repo_kind() {
|
match chart.get_repo_kind() {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
return match res {
|
match res {
|
||||||
crate::config::RepositoryKind::Helm => {
|
crate::config::RepositoryKind::Helm => {
|
||||||
let helm: helm::Helm = chart.into();
|
let helm: helm::Helm = chart.into();
|
||||||
Ok(Box::new(helm))
|
Ok(Box::new(helm))
|
||||||
@ -48,6 +48,6 @@ pub(crate) fn repo_from_chart(chart: Chart) -> Result<Box<dyn Repo>, Box<dyn std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => return Err(Box::from(err)),
|
Err(err) => Err(err),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user