started fixing clippy issues
This commit is contained in:
parent
c9a8c637c4
commit
a718f6f8fb
|
@ -69,7 +69,7 @@ pub fn split_tag_from_repo(input: &str) -> Result<(&str, &str), Error> {
|
||||||
|
|
||||||
pub fn split_repo_without_tag(repo: &str) -> Result<Repo, Error> {
|
pub fn split_repo_without_tag(repo: &str) -> Result<Repo, Error> {
|
||||||
let repo = repo.trim();
|
let repo = repo.trim();
|
||||||
let split_repo: Vec<&str> = repo.split("/").collect();
|
let split_repo: Vec<&str> = repo.split('/').collect();
|
||||||
match split_repo.len() {
|
match split_repo.len() {
|
||||||
1 => {
|
1 => {
|
||||||
let regex = regex::Regex::new(r"[a-z0-9]+").unwrap();
|
let regex = regex::Regex::new(r"[a-z0-9]+").unwrap();
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl Ui {
|
||||||
}
|
}
|
||||||
Ok(tag) => tag,
|
Ok(tag) => tag,
|
||||||
};
|
};
|
||||||
repo.push_str(":");
|
repo.push(':');
|
||||||
repo.push_str(&tag);
|
repo.push_str(&tag);
|
||||||
ui.services.change_current_line(repo);
|
ui.services.change_current_line(repo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,7 @@ impl ServiceSwitcher {
|
||||||
|
|
||||||
/// finds the next image tag in given file
|
/// finds the next image tag in given file
|
||||||
pub fn find_next_match(&mut self) -> bool {
|
pub fn find_next_match(&mut self) -> bool {
|
||||||
let current_line: usize = match self.state.selected() {
|
let current_line: usize = self.state.selected().unwrap_or(0);
|
||||||
None => 0,
|
|
||||||
Some(i) => i,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut i = (current_line + 1) % self.list.len();
|
let mut i = (current_line + 1) % self.list.len();
|
||||||
loop {
|
loop {
|
||||||
|
@ -131,10 +128,7 @@ impl ServiceSwitcher {
|
||||||
|
|
||||||
/// finds the previous image tag in given file
|
/// finds the previous image tag in given file
|
||||||
pub fn find_previous_match(&mut self) -> bool {
|
pub fn find_previous_match(&mut self) -> bool {
|
||||||
let current_line: usize = match self.state.selected() {
|
let current_line: usize = self.state.selected().unwrap_or(0);
|
||||||
None => 0,
|
|
||||||
Some(i) => i,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut i: usize = if current_line == 0 {
|
let mut i: usize = if current_line == 0 {
|
||||||
self.list.len() - 1
|
self.list.len() - 1
|
||||||
|
@ -165,10 +159,10 @@ impl ServiceSwitcher {
|
||||||
/// return the repository from currently selected row
|
/// return the repository from currently selected row
|
||||||
pub fn extract_repo(&self) -> Result<String, Error> {
|
pub fn extract_repo(&self) -> Result<String, Error> {
|
||||||
match self.state.selected() {
|
match self.state.selected() {
|
||||||
None => return Err(Error::NoneSelected),
|
None => Err(Error::NoneSelected),
|
||||||
Some(i) => match repo::match_yaml_image(&self.list[i]) {
|
Some(i) => match repo::match_yaml_image(&self.list[i]) {
|
||||||
Err(_) => return Err(Error::Parsing(String::from("Nothing found"))),
|
Err(_) => Err(Error::Parsing(String::from("Nothing found"))),
|
||||||
Ok((_, repo)) => return Ok(repo.to_string()),
|
Ok((_, repo)) => Ok(repo.to_string()),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ impl TagList {
|
||||||
/// select next tag
|
/// select next tag
|
||||||
fn next(&mut self) {
|
fn next(&mut self) {
|
||||||
match self.state.selected() {
|
match self.state.selected() {
|
||||||
None if self.lines.len() > 0 => self.state.select(Some(0)),
|
None if !self.lines.is_empty() => self.state.select(Some(0)),
|
||||||
None => (),
|
None => (),
|
||||||
Some(i) if i == self.lines.len() - 1 => self.state.select(Some(0)),
|
Some(i) if i == self.lines.len() - 1 => self.state.select(Some(0)),
|
||||||
Some(i) => self.state.select(Some(i + 1)),
|
Some(i) => self.state.select(Some(i + 1)),
|
||||||
|
@ -173,7 +173,7 @@ impl TagList {
|
||||||
/// select previous tag
|
/// select previous tag
|
||||||
fn previous(&mut self) {
|
fn previous(&mut self) {
|
||||||
match self.state.selected() {
|
match self.state.selected() {
|
||||||
None if self.lines.len() > 0 => self.state.select(Some(self.lines.len())),
|
None if !self.lines.is_empty() => self.state.select(Some(self.lines.len())),
|
||||||
None => (),
|
None => (),
|
||||||
Some(i) if i == 0 => self.state.select(Some(self.lines.len() - 1)),
|
Some(i) if i == 0 => self.state.select(Some(self.lines.len() - 1)),
|
||||||
Some(i) => self.state.select(Some(i - 1)),
|
Some(i) => self.state.select(Some(i - 1)),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user