Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some minor clippy lints #41

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn parse_signal(arg: &str) -> Result<Signal, std::io::Error> {
Ok(str_arg) => {
let signal_str = str_arg.to_uppercase();
let signal = Signal::from_str(signal_str.as_str())?;
return Ok(signal);
Ok(signal)
}
Err(e) => Err(std::io::Error::new(std::io::ErrorKind::Other, e)),
}
Expand Down
6 changes: 3 additions & 3 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl DockerContainer {
///
/// * `name` - A container name.
/// * `signal` - A enum value representing the signal type.
pub fn kill_container(name: &String, signal: Signal) -> Result<(), Error> {
pub fn kill_container(name: &str, signal: Signal) -> Result<(), Error> {
let rt = Runtime::new()?;
rt.block_on(async {
let docker = Docker::connect_with_socket_defaults()
Expand Down Expand Up @@ -63,8 +63,8 @@ impl DockerContainer {
.as_ref()?
.first()
.map(|name| DockerContainer {
name: if name.starts_with('/') {
name[1..].to_string()
name: if let Some(stripped) = name.strip_prefix('/') {
stripped.to_string()
} else {
name.clone()
},
Expand Down
5 changes: 1 addition & 4 deletions src/killport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ impl Killable for DockerContainer {
///
/// * `signal` - A enum value representing the signal type.
fn kill(&self, signal: Signal) -> Result<bool, Error> {
if let Err(err) = Self::kill_container(&self.name, signal) {
return Err(err);
}

Self::kill_container(&self.name, signal)?;
Ok(true)
}

Expand Down
2 changes: 1 addition & 1 deletion src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn find_target_processes(port: u16) -> Result<Vec<NativeProcess>, Error> {
debug!("Found process '{}' with PID {}", name, process.pid());
target_pids.push(NativeProcess {
pid: Pid::from_raw(process.pid),
name: name,
name,
});
}
}
Expand Down