Skip to content

Commit b03aee0

Browse files
authored
Fixed crate_universe clippy defects (#1228)
* Fixed `crate_universe` clippy defects * reenable clippy for `cargo_bazel`
1 parent 41b39f0 commit b03aee0

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

crate_universe/BUILD.bazel

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ filegroup(
5555
visibility = ["//:__subpackages__"],
5656
)
5757

58-
TAGS = [
59-
# https://github.com/rust-lang/rust-clippy/issues/8470
60-
"noclippy",
61-
]
62-
6358
rust_library(
6459
name = "cargo_bazel",
6560
srcs = glob(
@@ -72,7 +67,6 @@ rust_library(
7267
exclude = ["src/**/*.rs"],
7368
),
7469
proc_macro_deps = all_crate_deps(proc_macro = True),
75-
tags = TAGS,
7670
version = VERSION,
7771
visibility = ["//visibility:public"],
7872
deps = all_crate_deps(normal = True),
@@ -81,7 +75,6 @@ rust_library(
8175
rust_binary(
8276
name = "cargo_bazel_bin",
8377
srcs = ["src/main.rs"],
84-
tags = TAGS,
8578
version = VERSION,
8679
visibility = ["//visibility:public"],
8780
deps = [":cargo_bazel"],
@@ -108,7 +101,6 @@ rust_test(
108101
"CARGO": "$(rootpath @rules_rust//rust/toolchain:current_exec_cargo_files)",
109102
"RUSTC": "$(rootpath @rules_rust//rust/toolchain:current_exec_rustc_files)",
110103
},
111-
tags = TAGS,
112104
deps = [
113105
"@rules_rust//tools/runfiles",
114106
] + all_crate_deps(

crate_universe/src/context/crate_context.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,10 @@ impl CrateContext {
563563
let crate_name = sanitize_module_name(&target.name);
564564

565565
// Locate the crate's root source file relative to the package root normalized for unix
566-
let crate_root =
567-
pathdiff::diff_paths(target.src_path.to_string(), package_root).map(
568-
// Normalize the path so that it always renders the same regardless of platform
569-
|root| root.to_string_lossy().replace("\\", "/"),
570-
);
566+
let crate_root = pathdiff::diff_paths(&target.src_path, package_root).map(
567+
// Normalize the path so that it always renders the same regardless of platform
568+
|root| root.to_string_lossy().replace('\\', "/"),
569+
);
571570

572571
// Conditionally check to see if the dependencies is a build-script target
573572
if include_build_scripts && kind == "custom-build" {

crate_universe/src/splicing/splicer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a> SplicerKind<'a> {
9696
!manifests.keys().any(|path| {
9797
let path_str = path.to_string_lossy().to_string();
9898
// Account for windows paths.
99-
let path_str = path_str.replace("\\", "/");
99+
let path_str = path_str.replace('\\', "/");
100100
// Workspace members are represented as directories.
101101
path_str.trim_end_matches("/Cargo.toml").ends_with(member)
102102
})
@@ -1015,7 +1015,7 @@ mod test {
10151015
// On windows, make sure we normalize the path to match what Cargo would
10161016
// otherwise use to populate metadata.
10171017
if cfg!(target_os = "windows") {
1018-
workspace_root = format!("/{}", workspace_root.replace("\\", "/"))
1018+
workspace_root = format!("/{}", workspace_root.replace('\\', "/"))
10191019
};
10201020

10211021
if is_root {

0 commit comments

Comments
 (0)