Skip to content

Commit e452a59

Browse files
committed
Applying clippy fixes to dev-tracker-cli.
1 parent 51f39e4 commit e452a59

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

dev-tracker-cli/src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use dev_tracker_core::data::DataStore;
88
mod cli;
99
mod ops;
1010

11-
const APP_NAME: &'static str = "dev-tracker";
11+
const APP_NAME: &str = "dev-tracker";
1212

1313
fn main() -> anyhow::Result<()> {
1414
let args = cli::Arguments::parse();
@@ -100,10 +100,3 @@ fn default_data_file_path() -> PathBuf {
100100
path.set_extension("sqlite");
101101
path
102102
}
103-
104-
// fn default_config_file_path() -> PathBuf {
105-
// let mut path = default_file_directory();
106-
// path.push("config");
107-
// path.set_extension("toml");
108-
// path
109-
// }

dev-tracker-cli/src/ops.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn describe_project(args: DescribeProjectArgs, ds: &DataStore) -> anyhow::Re
136136
let repos = ds.get_repos(&project)?;
137137
for repo in repos.iter() {
138138
println!("Repository path '{}'", repo.path().display());
139-
if let Some(count) = ds.get_latest_count(&repo)? {
139+
if let Some(count) = ds.get_latest_count(repo)? {
140140
println!(" {} lines of code", ds.get_total_loc(&count)?)
141141
}
142142
}
@@ -247,7 +247,7 @@ pub fn list_projects(args: ListProjectArgs, ds: &DataStore) -> anyhow::Result<()
247247
println!("{}", project.name());
248248
}
249249

250-
if projects.len() < 1 {
250+
if projects.is_empty() {
251251
println!("No projects in database");
252252
}
253253

@@ -301,19 +301,19 @@ pub fn list_activities(args: ListActivityArgs, ds: &DataStore) -> anyhow::Result
301301

302302
println!(
303303
"from {} until {}, total time {}",
304-
local_start.format("%I:%M%P on %A %d %B %Y").to_string(),
305-
local_end.format("%I:%M%P on %A %d %B %Y").to_string(),
304+
local_start.format("%I:%M%P on %A %d %B %Y"),
305+
local_end.format("%I:%M%P on %A %d %B %Y"),
306306
duration
307307
)
308308
} else {
309309
println!(
310310
"started at {}, and is still running",
311-
local_start.format("%I:%M%P on %A %d %B %Y").to_string()
311+
local_start.format("%I:%M%P on %A %d %B %Y")
312312
)
313313
}
314314
}
315315

316-
if activities.len() < 1 {
316+
if activities.is_empty() {
317317
println!("No activities for project {} in database", project.name());
318318
}
319319

@@ -329,7 +329,7 @@ pub fn list_activitytypes(args: ListActivityTypeArgs, ds: &DataStore) -> anyhow:
329329
println!("{}", at.name());
330330
}
331331

332-
if ats.len() < 1 {
332+
if ats.is_empty() {
333333
println!("No activity types in database");
334334
}
335335

@@ -344,7 +344,7 @@ pub fn list_counts(args: ListCountArgs, ds: &DataStore) -> anyhow::Result<()> {
344344

345345
let repos = ds.get_repos(&project)?;
346346
for repo in repos.iter() {
347-
let counts = ds.get_counts(&repo)?;
347+
let counts = ds.get_counts(repo)?;
348348
for count in counts {
349349
if args.verbose {
350350
print!("{}. ", count.id());
@@ -358,7 +358,7 @@ pub fn list_counts(args: ListCountArgs, ds: &DataStore) -> anyhow::Result<()> {
358358
}
359359
}
360360

361-
if repos.len() < 1 {
361+
if repos.is_empty() {
362362
println!("No repositories for project {} in database", project.name());
363363
}
364364

@@ -379,7 +379,7 @@ pub fn list_repos(args: ListRepoArgs, ds: &DataStore) -> anyhow::Result<()> {
379379
println!("{}", repo.path().display());
380380
}
381381

382-
if repos.len() < 1 {
382+
if repos.is_empty() {
383383
println!("No repositories for project {} in database", project.name());
384384
}
385385

0 commit comments

Comments
 (0)