Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ fn docker_ps(_verbose: u8) -> Result<()> {
if parts.len() >= 4 {
let id = &parts[0][..12.min(parts[0].len())];
let name = parts[1];
let short_image = parts.get(3).unwrap_or(&"").split('/').last().unwrap_or("");
let short_image = parts
.get(3)
.unwrap_or(&"")
.split('/')
.next_back()
.unwrap_or("");
let ports = compact_ports(parts.get(4).unwrap_or(&""));
if ports == "-" {
rtk.push_str(&format!(" {} {} ({})\n", id, name, short_image));
Expand Down Expand Up @@ -508,7 +513,7 @@ fn compact_ports(ports: &str) -> String {
// Extract just the port numbers
let port_nums: Vec<&str> = ports
.split(',')
.filter_map(|p| p.split("->").next().and_then(|s| s.split(':').last()))
.filter_map(|p| p.split("->").next().and_then(|s| s.split(':').next_back()))
.collect();

if port_nums.len() <= 3 {
Expand Down
6 changes: 3 additions & 3 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ fn run_log(

// Check if user provided limit flag (-N, -n N, --max-count=N, --max-count N)
let has_limit_flag = args.iter().any(|arg| {
(arg.starts_with('-') && arg.chars().nth(1).map_or(false, |c| c.is_ascii_digit()))
(arg.starts_with('-') && arg.chars().nth(1).is_some_and(|c| c.is_ascii_digit()))
|| arg == "-n"
|| arg.starts_with("--max-count")
});
Expand Down Expand Up @@ -433,7 +433,7 @@ fn parse_user_limit(args: &[String]) -> Option<usize> {
// -20 (combined digit form)
if arg.starts_with('-')
&& arg.len() > 1
&& arg.chars().nth(1).map_or(false, |c| c.is_ascii_digit())
&& arg.chars().nth(1).is_some_and(|c| c.is_ascii_digit())
{
if let Ok(n) = arg[1..].parse::<usize>() {
return Some(n);
Expand Down Expand Up @@ -815,7 +815,7 @@ fn run_commit(args: &[String], verbose: u8, global_args: &[String]) -> Result<()
// Extract commit hash from output like "[main abc1234] message"
let compact = if let Some(line) = stdout.lines().next() {
if let Some(hash_start) = line.find(' ') {
let hash = line[1..hash_start].split(' ').last().unwrap_or("");
let hash = line[1..hash_start].split(' ').next_back().unwrap_or("");
if !hash.is_empty() && hash.len() >= 7 {
format!("ok ✓ {}", &hash[..7.min(hash.len())])
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ pub fn uninstall(global: bool, verbose: u8) -> Result<()> {
fs::write(&claude_md_path, cleaned).with_context(|| {
format!("Failed to write CLAUDE.md: {}", claude_md_path.display())
})?;
removed.push(format!("CLAUDE.md: removed @RTK.md reference"));
removed.push("CLAUDE.md: removed @RTK.md reference".to_string());
}
}

Expand Down Expand Up @@ -566,7 +566,7 @@ fn patch_settings_json(
};

// Check idempotency
if hook_already_present(&root, &hook_command) {
if hook_already_present(&root, hook_command) {
if verbose > 0 {
eprintln!("settings.json: hook already present");
}
Expand All @@ -591,7 +591,7 @@ fn patch_settings_json(
}

// Deep-merge hook
insert_hook_entry(&mut root, &hook_command);
insert_hook_entry(&mut root, hook_command);

// Backup original
if settings_path.exists() {
Expand Down