Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
chore: run cargo clippy --fix
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Chen <rui@chenrui.dev>
  • Loading branch information
chenrui333 committed Aug 26, 2023
1 parent fb30442 commit 9739f59
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn tools_default(path: &str) -> bool {

#[inline]
fn external_workspace(path: &str) -> bool {
path.starts_with("@")
path.starts_with('@')
}

#[inline]
Expand All @@ -54,9 +54,9 @@ fn aliased(path: &str) -> bool {

#[inline]
fn clean_path(path: &str) -> String {
path.trim_left_matches("//:")
.trim_left_matches("//")
.replace(":", "/")
path.trim_start_matches("//:")
.trim_start_matches("//")
.replace(':', "/")
}

#[inline]
Expand All @@ -66,7 +66,7 @@ fn watchable(path: &str) -> bool {

#[inline]
fn buildfile(path: PathBuf) -> bool {
path.ends_with("BUILD") || path.extension().iter().find(|ext| **ext == "bzl").is_some()
path.ends_with("BUILD") || path.extension().iter().any(|ext| *ext == "bzl")
}

fn query(executable: &String, q: String) -> Result<Vec<String>> {
Expand Down Expand Up @@ -110,11 +110,11 @@ fn watch(
watcher: &mut RecommendedWatcher,
) -> Result<()> {
for target in targets {
for file in sources(&executable, &target)? {
for file in sources(executable, target)? {
debug!("watching source file: {file}", file = file);
watcher.watch(file, RecursiveMode::NonRecursive)?;
}
for file in builds(&executable, &target)? {
for file in builds(executable, target)? {
debug!("watching build file: {file}", file = file);
watcher.watch(file, RecursiveMode::NonRecursive)?;
}
Expand Down Expand Up @@ -165,7 +165,7 @@ fn app() -> Result<()> {
let args = env::args().skip(2).collect::<Vec<_>>();
let targets = args.iter()
// skip flags
.skip_while(|arg| arg.starts_with("-"))
.skip_while(|arg| arg.starts_with('-'))
.collect::<Vec<_>>();
if targets.is_empty() {
return Err(ErrorKind::MissingTargets.into());
Expand All @@ -185,7 +185,7 @@ fn app() -> Result<()> {
watch(&executable, targets.clone(), &mut watcher)?
}
child = exec(&executable, &action, args.clone())?;
()

}
_ => (),
}
Expand All @@ -196,7 +196,7 @@ fn app() -> Result<()> {
}

fn main() {
if let Err(_) = env::var("RUST_LOG") {
if env::var("RUST_LOG").is_err() {
env::set_var("RUST_LOG", "info");
}
pretty_env_logger::init();
Expand Down

0 comments on commit 9739f59

Please sign in to comment.