Skip to content

Commit cd4e97f

Browse files
committed
fix: resolve clippy warnings and apply rustfmt
- Use enumerate() instead of manual counter in text.rs - Remove needless borrows across main.rs, commands/*, output.rs - Apply rustfmt formatting
1 parent 3461bcc commit cd4e97f

20 files changed

Lines changed: 98 additions & 68 deletions

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/api.rs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,14 @@ impl LinearClient {
108108
403 => CliError::new(3, "Access denied - insufficient permissions"),
109109
404 => CliError::new(2, "Resource not found"),
110110
429 => CliError::new(4, "Rate limit exceeded").with_retry_after(retry_after),
111-
_ => CliError::new(1, format!("HTTP {} {}", status.as_u16(), details["reason"].as_str().unwrap_or("Unknown error"))),
111+
_ => CliError::new(
112+
1,
113+
format!(
114+
"HTTP {} {}",
115+
status.as_u16(),
116+
details["reason"].as_str().unwrap_or("Unknown error")
117+
),
118+
),
112119
};
113120
return Err(err.with_details(details).into());
114121
}
@@ -152,7 +159,14 @@ impl LinearClient {
152159
403 => CliError::new(3, "Access denied to this upload"),
153160
404 => CliError::new(2, "Upload not found"),
154161
429 => CliError::new(4, "Rate limit exceeded").with_retry_after(retry_after),
155-
_ => CliError::new(1, format!("HTTP {} {}", status.as_u16(), details["reason"].as_str().unwrap_or("Unknown error"))),
162+
_ => CliError::new(
163+
1,
164+
format!(
165+
"HTTP {} {}",
166+
status.as_u16(),
167+
details["reason"].as_str().unwrap_or("Unknown error")
168+
),
169+
),
156170
};
157171
return Err(err.with_details(details).into());
158172
}

‎src/commands/bulk.rs‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use futures::future::join_all;
55
use serde_json::json;
66

77
use crate::api::LinearClient;
8+
use crate::display_options;
89
use crate::output::{print_json, OutputOptions};
910
use crate::text::truncate;
10-
use crate::display_options;
1111

1212
#[derive(Subcommand)]
1313
pub enum BulkCommands {
@@ -260,7 +260,10 @@ pub async fn handle(cmd: BulkCommands, output: &OutputOptions) -> Result<()> {
260260
async fn bulk_update_state(state: &str, issues: Vec<String>, output: &OutputOptions) -> Result<()> {
261261
if issues.is_empty() {
262262
if output.is_json() {
263-
print_json(&json!({ "error": "No issues specified", "results": [] }), &output.json)?;
263+
print_json(
264+
&json!({ "error": "No issues specified", "results": [] }),
265+
&output.json,
266+
)?;
264267
} else {
265268
println!("No issues specified.");
266269
}
@@ -298,7 +301,10 @@ async fn bulk_update_state(state: &str, issues: Vec<String>, output: &OutputOpti
298301
async fn bulk_assign(user: &str, issues: Vec<String>, output: &OutputOptions) -> Result<()> {
299302
if issues.is_empty() {
300303
if output.is_json() {
301-
print_json(&json!({ "error": "No issues specified", "results": [] }), &output.json)?;
304+
print_json(
305+
&json!({ "error": "No issues specified", "results": [] }),
306+
&output.json,
307+
)?;
302308
} else {
303309
println!("No issues specified.");
304310
}
@@ -351,7 +357,10 @@ async fn bulk_assign(user: &str, issues: Vec<String>, output: &OutputOptions) ->
351357
async fn bulk_label(label: &str, issues: Vec<String>, output: &OutputOptions) -> Result<()> {
352358
if issues.is_empty() {
353359
if output.is_json() {
354-
print_json(&json!({ "error": "No issues specified", "results": [] }), &output.json)?;
360+
print_json(
361+
&json!({ "error": "No issues specified", "results": [] }),
362+
&output.json,
363+
)?;
355364
} else {
356365
println!("No issues specified.");
357366
}
@@ -404,7 +413,10 @@ async fn bulk_label(label: &str, issues: Vec<String>, output: &OutputOptions) ->
404413
async fn bulk_unassign(issues: Vec<String>, output: &OutputOptions) -> Result<()> {
405414
if issues.is_empty() {
406415
if output.is_json() {
407-
print_json(&json!({ "error": "No issues specified", "results": [] }), &output.json)?;
416+
print_json(
417+
&json!({ "error": "No issues specified", "results": [] }),
418+
&output.json,
419+
)?;
408420
} else {
409421
println!("No issues specified.");
410422
}

‎src/commands/comments.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use serde_json::json;
55
use tabled::{Table, Tabled};
66

77
use crate::api::LinearClient;
8+
use crate::display_options;
89
use crate::output::{print_json, OutputOptions};
910
use crate::text::truncate;
10-
use crate::display_options;
1111

1212
#[derive(Subcommand)]
1313
pub enum CommentCommands {

‎src/commands/cycles.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use serde_json::json;
55
use tabled::{Table, Tabled};
66

77
use crate::api::{resolve_team_id, LinearClient};
8+
use crate::display_options;
89
use crate::output::{print_json, OutputOptions};
910
use crate::text::truncate;
10-
use crate::display_options;
1111

1212
#[derive(Subcommand)]
1313
pub enum CycleCommands {
@@ -91,7 +91,7 @@ async fn list_cycles(team: &str, include_all: bool, output: &OutputOptions) -> R
9191
}
9292

9393
if output.is_json() {
94-
print_json(&team_data, &output.json)?;
94+
print_json(team_data, &output.json)?;
9595
return Ok(());
9696
}
9797

@@ -204,7 +204,7 @@ async fn current_cycle(team: &str, output: &OutputOptions) -> Result<()> {
204204
}
205205

206206
if output.is_json() {
207-
print_json(&team_data, &output.json)?;
207+
print_json(team_data, &output.json)?;
208208
return Ok(());
209209
}
210210

‎src/commands/git.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,11 @@ async fn show_commits(limit: usize, vcs: Vcs) -> Result<()> {
562562
format!("[{}]", issue_id).cyan()
563563
);
564564
} else {
565-
println!("{} {}", change_id.dimmed(), truncate(description, desc_width));
565+
println!(
566+
"{} {}",
567+
change_id.dimmed(),
568+
truncate(description, desc_width)
569+
);
566570
}
567571
}
568572

‎src/commands/interactive.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use serde_json::json;
66
use tabled::{Table, Tabled};
77

88
use crate::api::LinearClient;
9-
use crate::text::truncate;
109
use crate::display_options;
10+
use crate::text::truncate;
1111

1212
#[derive(Debug, Clone)]
1313
struct Team {

‎src/commands/issues.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use std::process::Command;
77
use tabled::{Table, Tabled};
88

99
use crate::api::{resolve_team_id, LinearClient};
10+
use crate::display_options;
1011
use crate::output::{print_json, OutputOptions};
1112
use crate::text::truncate;
12-
use crate::display_options;
1313
use crate::AgentOptions;
1414

1515
use super::templates;

‎src/commands/labels.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use serde_json::json;
55
use tabled::{Table, Tabled};
66

77
use crate::api::LinearClient;
8+
use crate::display_options;
89
use crate::output::{print_json, OutputOptions};
910
use crate::text::truncate;
10-
use crate::display_options;
1111

1212
#[derive(Subcommand)]
1313
pub enum LabelCommands {

‎src/commands/notifications.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use serde_json::json;
55
use tabled::{Table, Tabled};
66

77
use crate::api::LinearClient;
8+
use crate::display_options;
89
use crate::output::{print_json, OutputOptions};
910
use crate::text::truncate;
10-
use crate::display_options;
1111

1212
#[derive(Subcommand)]
1313
pub enum NotificationCommands {

0 commit comments

Comments
 (0)