Skip to content

Commit

Permalink
Fix clippy warnings for //tools/rust_analyzer:gen_rust_project (#746)
Browse files Browse the repository at this point in the history
* Fix clippy warnings for //tools/rust_analyzer:gen_rust_project

* buildifier tools/rustfmt/BUILD.bazel
  • Loading branch information
Kohei Watanabe authored May 18, 2021
1 parent 61aafc3 commit d6cf2ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
11 changes: 10 additions & 1 deletion tools/rust_analyzer/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//rust:defs.bzl", "rust_binary")
load("//rust:defs.bzl", "rust_binary", "rust_clippy")

rust_binary(
name = "gen_rust_project",
Expand All @@ -11,3 +11,12 @@ rust_binary(
"//util/label",
],
)

rust_clippy(
name = "gen_rust_project_clippy",
testonly = True,
visibility = ["//visibility:private"],
deps = [
":gen_rust_project",
],
)
4 changes: 2 additions & 2 deletions tools/rust_analyzer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn parse_config() -> anyhow::Result<Config> {
let output = String::from_utf8_lossy(&output.stdout.as_slice());
let bazel_info = output
.trim()
.split("\n")
.map(|line| line.split_at(line.find(":").expect("missing `:` in bazel info output")))
.split('\n')
.map(|line| line.split_at(line.find(':').expect("missing `:` in bazel info output")))
.map(|(k, v)| (k, (&v[1..]).trim()))
.collect::<HashMap<_, _>>();

Expand Down
11 changes: 10 additions & 1 deletion tools/rustfmt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//rust:defs.bzl", "rust_binary", "rust_library")
load("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -58,3 +58,12 @@ rust_binary(
"//tools/runfiles",
],
)

rust_clippy(
name = "rustfmt_clippy",
testonly = True,
visibility = ["//visibility:private"],
deps = [
":rustfmt",
],
)

0 comments on commit d6cf2ec

Please sign in to comment.