Skip to content

Commit 27c4f92

Browse files
committed
fix(clippy): use strip_prefix instead of manual prefix stripping
1 parent 6c3fff3 commit 27c4f92

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/src/agent_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ impl Agent {
516516
let source = config_source.into();
517517

518518
// Expand leading `~/` to the user's home directory
519-
let expanded = if source.starts_with("~/") {
519+
let expanded = if let Some(rest) = source.strip_prefix("~/") {
520520
if let Some(home) = std::env::var_os("HOME") {
521-
format!("{}/{}", home.to_string_lossy(), &source[2..])
521+
format!("{}/{}", home.to_string_lossy(), rest)
522522
} else {
523523
source.clone()
524524
}

0 commit comments

Comments
 (0)