Skip to content

Commit ad5b2cd

Browse files
authored
Fix formatting issues (#3615)
1 parent 12762a7 commit ad5b2cd

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

rust/private/providers.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ CrateInfo = provider(
1818
doc = "A provider containing general Crate information.",
1919
fields = {
2020
"aliases": "Dict[Label, String]: Renamed and aliased crates",
21+
"cfgs": (
22+
"List[str]: The set of enabled cfgs for this crate. Note that this field is populated only " +
23+
"when @rules_rust//rust/settings:collect_cfgs is set."
24+
),
2125
"compile_data": "depset[File]: Compile data required by this crate.",
2226
"compile_data_targets": "depset[Label]: Compile data targets required by this crate.",
2327
"data": "depset[File]: Compile data required by crates that use the current crate as a proc-macro.",
@@ -46,10 +50,6 @@ CrateInfo = provider(
4650
"str, optional: The original crate type for targets generated using a previously defined " +
4751
"crate (typically tests using the `rust_test::crate` attribute)"
4852
),
49-
"cfgs": (
50-
"List[str]: The set of enabled cfgs for this crate. Note that this field is populated only " +
51-
"when @rules_rust//rust/settings:collect_cfgs is set."
52-
),
5353
},
5454
)
5555

rust/private/rust.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,14 +799,14 @@ _common_attrs = {
799799
doc = "A version to inject in the cargo environment variable.",
800800
default = "0.0.0",
801801
),
802-
"_stamp_flag": attr.label(
803-
doc = "A setting used to determine whether or not the `--stamp` flag is enabled",
804-
default = Label("//rust/private:stamp"),
805-
),
806802
"_collect_cfgs": attr.label(
807803
doc = "Enable collection of cfg flags with results stored in CrateInfo.cfgs.",
808804
default = Label("//rust/settings:collect_cfgs"),
809805
),
806+
"_stamp_flag": attr.label(
807+
doc = "A setting used to determine whether or not the `--stamp` flag is enabled",
808+
default = Label("//rust/private:stamp"),
809+
),
810810
} | RUSTC_ATTRS | _rustc_allocator_libraries_attrs
811811

812812
_coverage_attrs = {
@@ -1719,7 +1719,7 @@ def _replace_illlegal_chars(name):
17191719
def _collect_cfgs(ctx, toolchain, crate_root, crate_type, crate_is_test):
17201720
"""Collect all cfg flags for a crate but only when @rules_rust//rust/settings:collect_cfgs is set.
17211721
1722-
Cfgs are gathered from the target's own attributes (e.g., rustc_flags, crate_featues, etc.), as
1722+
Cfgs are gathered from the target's own attributes (e.g., rustc_flags, crate_features, etc.), as
17231723
well as from the toolchain (e.g., toolchain.extra_rustc_flags).
17241724
17251725
Args:

test/unit/collect_cfgs/collect_cfgs_test.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""collect_cfgs_test_suite"""
2+
13
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
24
load("//rust:defs.bzl", "rust_library", "rust_proc_macro")
35
load("//rust:rust_common.bzl", "CrateInfo")
@@ -114,6 +116,11 @@ collect_cfgs_extra_exec_rustc_flags_test = analysistest.make(
114116
)
115117

116118
def collect_cfgs_test_suite(name):
119+
"""Tests for the `//rust/settings:collect_cfgs` settings.
120+
121+
Args:
122+
name (str): The name of the test suite.
123+
"""
117124
rust_library(
118125
name = "lib",
119126
srcs = ["lib.rs"],

0 commit comments

Comments
 (0)