Various cleanups (#1828)
diff --git a/docs/index.md b/docs/index.md
index 62532f1..78fdd1d 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -60,7 +60,9 @@
```python
rust_register_toolchains(
edition = "2021",
- versions = ["1.66.1"],
+ versions = [
+ "1.66.1"
+ ],
)
```
diff --git a/proto/repositories.bzl b/proto/repositories.bzl
index 1591613..ddb17e1 100644
--- a/proto/repositories.bzl
+++ b/proto/repositories.bzl
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# buildifier: disable=module-docstring
+"""Dependencies for Rust proto rules"""
+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//proto/3rdparty/crates:defs.bzl", "crate_repositories")
diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl
index d0f04ea..b98aab6 100644
--- a/rust/private/clippy.bzl
+++ b/rust/private/clippy.bzl
@@ -217,8 +217,12 @@
doc = "The desired `--error-format` flags for clippy",
default = "//:error_format",
),
- "_extra_rustc_flag": attr.label(default = "//:extra_rustc_flag"),
- "_extra_rustc_flags": attr.label(default = "//:extra_rustc_flags"),
+ "_extra_rustc_flag": attr.label(
+ default = Label("//:extra_rustc_flag"),
+ ),
+ "_extra_rustc_flags": attr.label(
+ default = Label("//:extra_rustc_flags"),
+ ),
"_process_wrapper": attr.label(
doc = "A process wrapper for running clippy on all platforms",
default = Label("//util/process_wrapper"),
diff --git a/rust/private/dummy_cc_toolchain/dummy_cc_toolchain.bzl b/rust/private/dummy_cc_toolchain/dummy_cc_toolchain.bzl
index e867564..8cbf617 100644
--- a/rust/private/dummy_cc_toolchain/dummy_cc_toolchain.bzl
+++ b/rust/private/dummy_cc_toolchain/dummy_cc_toolchain.bzl
@@ -1,4 +1,5 @@
-# buildifier: disable=module-docstring
+"""Cc toolchain definitions for use on wasm platforms"""
+
def _dummy_cc_toolchain_impl(_ctx):
# The `all_files` attribute is referenced by rustc_compile_action().
return [platform_common.ToolchainInfo(all_files = depset([]))]
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index 6f237a9..42704b5 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# buildifier: disable=module-docstring
+"""Rust rule implementations"""
+
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//rust/private:common.bzl", "rust_common")
load("//rust/private:rustc.bzl", "rustc_compile_action")
diff --git a/rust/private/transitions.bzl b/rust/private/transitions.bzl
index 23336f4..cbc6a06 100644
--- a/rust/private/transitions.bzl
+++ b/rust/private/transitions.bzl
@@ -1,26 +1,7 @@
-# buildifier: disable=module-docstring
+"""Internal transition implementations for core Rust rules"""
+
load("//rust:defs.bzl", "rust_common")
-def _wasm_bindgen_transition(_settings, _attr):
- """The implementation of the `wasm_bindgen_transition` transition
-
- Args:
- _settings (dict): A dict {String:Object} of all settings declared
- in the inputs parameter to `transition()`
- _attr (dict): A dict of attributes and values of the rule to which
- the transition is attached
-
- Returns:
- dict: A dict of new build settings values to apply
- """
- return {"//command_line_option:platforms": str(Label("//rust/platform:wasm"))}
-
-wasm_bindgen_transition = transition(
- implementation = _wasm_bindgen_transition,
- inputs = [],
- outputs = ["//command_line_option:platforms"],
-)
-
def _import_macro_dep_bootstrap_transition(_settings, _attr):
"""The implementation of the `import_macro_dep_bootstrap_transition` transition.
diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl
index 0656bdd..47bebea 100644
--- a/rust/toolchain.bzl
+++ b/rust/toolchain.bzl
@@ -729,7 +729,7 @@
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_pipelined_compilation": attr.label(
- default = "@rules_rust//rust/settings:pipelined_compilation",
+ default = Label("//rust/settings:pipelined_compilation"),
),
"_rename_first_party_crates": attr.label(
default = Label("//rust/settings:rename_first_party_crates"),
diff --git a/test/load_arbitrary_tool/load_arbitrary_tool_test.bzl b/test/load_arbitrary_tool/load_arbitrary_tool_test.bzl
index deeba9c..5d8d91d 100644
--- a/test/load_arbitrary_tool/load_arbitrary_tool_test.bzl
+++ b/test/load_arbitrary_tool/load_arbitrary_tool_test.bzl
@@ -1,4 +1,5 @@
-# buildifier: disable=module-docstring
+"""Tests for `load_arbitrary_tool`"""
+
load("//rust:repositories.bzl", "load_arbitrary_tool")
load("//rust/platform:triple.bzl", "get_host_triple")
load("//rust/platform:triple_mappings.bzl", "system_to_binary_ext")
diff --git a/wasm_bindgen/BUILD.bazel b/wasm_bindgen/BUILD.bazel
index 1c5dade..db37710 100644
--- a/wasm_bindgen/BUILD.bazel
+++ b/wasm_bindgen/BUILD.bazel
@@ -20,6 +20,7 @@
deps = [
"//rust:bzl_lib",
"//wasm_bindgen/3rdparty:bzl_lib",
+ "//wasm_bindgen/private:bzl_lib",
],
)
diff --git a/wasm_bindgen/private/BUILD.bazel b/wasm_bindgen/private/BUILD.bazel
new file mode 100644
index 0000000..f719ebc
--- /dev/null
+++ b/wasm_bindgen/private/BUILD.bazel
@@ -0,0 +1,9 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+bzl_library(
+ name = "bzl_lib",
+ srcs = [
+ "transitions.bzl",
+ ],
+ visibility = ["//wasm_bindgen:__pkg__"],
+)
diff --git a/wasm_bindgen/private/transitions.bzl b/wasm_bindgen/private/transitions.bzl
new file mode 100644
index 0000000..ef84443
--- /dev/null
+++ b/wasm_bindgen/private/transitions.bzl
@@ -0,0 +1,21 @@
+"""Transition implementations for wasm-bindgen rust Rules"""
+
+def _wasm_bindgen_transition(_settings, _attr):
+ """The implementation of the `wasm_bindgen_transition` transition
+
+ Args:
+ _settings (dict): A dict {String:Object} of all settings declared
+ in the inputs parameter to `transition()`
+ _attr (dict): A dict of attributes and values of the rule to which
+ the transition is attached
+
+ Returns:
+ dict: A dict of new build settings values to apply
+ """
+ return {"//command_line_option:platforms": str(Label("//rust/platform:wasm"))}
+
+wasm_bindgen_transition = transition(
+ implementation = _wasm_bindgen_transition,
+ inputs = [],
+ outputs = ["//command_line_option:platforms"],
+)
diff --git a/wasm_bindgen/repositories.bzl b/wasm_bindgen/repositories.bzl
index e4ea784..9126e3a 100644
--- a/wasm_bindgen/repositories.bzl
+++ b/wasm_bindgen/repositories.bzl
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# buildifier: disable=module-docstring
+"""Dependency definitions for wasm-bindgen rules"""
+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//wasm_bindgen/3rdparty/crates:defs.bzl", "crate_repositories")
diff --git a/wasm_bindgen/wasm_bindgen.bzl b/wasm_bindgen/wasm_bindgen.bzl
index 9794313..437d884 100644
--- a/wasm_bindgen/wasm_bindgen.bzl
+++ b/wasm_bindgen/wasm_bindgen.bzl
@@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# buildifier: disable=module-docstring
-load("//rust:defs.bzl", "rust_common")
+"""Bazel rules for [wasm-bindgen](https://crates.io/crates/wasm-bindgen)"""
-# buildifier: disable=bzl-visibility
-load("//rust/private:transitions.bzl", "wasm_bindgen_transition")
+load("//rust:defs.bzl", "rust_common")
load(
"//wasm_bindgen:providers.bzl",
"DeclarationInfo",
"JSModuleInfo",
)
+load("//wasm_bindgen/private:transitions.bzl", "wasm_bindgen_transition")
_WASM_BINDGEN_DOC = """\
Generates javascript and typescript bindings for a webassembly module using [wasm-bindgen][ws].