Skip to content

Commit 1b94a15

Browse files
committed
Fix some minor clippy lints
1 parent 4997258 commit 1b94a15

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn parse_signal(arg: &str) -> Result<Signal, std::io::Error> {
8787
Ok(str_arg) => {
8888
let signal_str = str_arg.to_uppercase();
8989
let signal = Signal::from_str(signal_str.as_str())?;
90-
return Ok(signal);
90+
Ok(signal)
9191
}
9292
Err(e) => Err(std::io::Error::new(std::io::ErrorKind::Other, e)),
9393
}

src/docker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl DockerContainer {
1717
///
1818
/// * `name` - A container name.
1919
/// * `signal` - A enum value representing the signal type.
20-
pub fn kill_container(name: &String, signal: Signal) -> Result<(), Error> {
20+
pub fn kill_container(name: &str, signal: Signal) -> Result<(), Error> {
2121
let rt = Runtime::new()?;
2222
rt.block_on(async {
2323
let docker = Docker::connect_with_socket_defaults()
@@ -63,8 +63,8 @@ impl DockerContainer {
6363
.as_ref()?
6464
.first()
6565
.map(|name| DockerContainer {
66-
name: if name.starts_with('/') {
67-
name[1..].to_string()
66+
name: if let Some(stripped) = name.strip_prefix('/') {
67+
stripped.to_string()
6868
} else {
6969
name.clone()
7070
},

src/killport.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ impl Killable for DockerContainer {
6969
///
7070
/// * `signal` - A enum value representing the signal type.
7171
fn kill(&self, signal: Signal) -> Result<bool, Error> {
72-
if let Err(err) = Self::kill_container(&self.name, signal) {
73-
return Err(err);
74-
}
75-
72+
Self::kill_container(&self.name, signal)?;
7673
Ok(true)
7774
}
7875

src/linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub fn find_target_processes(port: u16) -> Result<Vec<NativeProcess>, Error> {
9898
debug!("Found process '{}' with PID {}", name, process.pid());
9999
target_pids.push(NativeProcess {
100100
pid: Pid::from_raw(process.pid),
101-
name: name,
101+
name,
102102
});
103103
}
104104
}

0 commit comments

Comments
 (0)