Skip to content

Commit

Permalink
dynamic_modules: enables rustfmt.toml (#37295)
Browse files Browse the repository at this point in the history
Commit Message: dynamic_modules: enables rustfmt.toml
Additional Description:

This enables the root configuration for rustfmt as a follow up
on
#37070 (comment).
Only formatting is done in this commit. There's no change in its code.

Risk Level: low
Testing: n/a 
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API
Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
  • Loading branch information
mathetake authored Nov 22, 2024
1 parent 19d1308 commit 22e7328
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 182 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ common:remote-envoy-engflow --config=common-envoy-engflow
common:remote-envoy-engflow --config=cache-envoy-engflow
common:remote-envoy-engflow --config=rbe-envoy-engflow

# Specifies the rustfmt.toml for all rustfmt_test targets.
build --@rules_rust//rust/settings:rustfmt.toml=//:rustfmt.toml

#############################################################################
# debug: Various Bazel debugging flags
#############################################################################
Expand Down
4 changes: 4 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ package_group(
"//mobile/...",
],
)

exports_files([
"rustfmt.toml",
])
60 changes: 60 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This config is copied from https://github.com/bitdriftlabs/shared-core/blob/4114708cafb80103092b7e585987ef275a136f87/rustfmt.toml

# Rust Autoformatter Config
# =========================
#
# Note that most of rustfmt's configurable settings are nightly-only,
# so we tend to run that. Typically we don't rely on unstable features,
# but in this case there's honestly not a lot to configure that _isn't_
# behind the `unstable_features` gate, unfortunately.

edition = "2021"
unstable_features = true

# Try to use inline annotations before using this -- disabling autoformatting
# for a file makes it harder for everyone to share their work in that file and
# invites bikeshedding about how code in there should look.
ignore = []

# Features are broken up into Stable and Unstable features, listed in order of
# appearance in the Configuring Rustfmt document:
# https://github.com/rust-lang-nursery/rustfmt/blob/master/Configurations.md

## Stable Features

force_explicit_abi = true # Default
hard_tabs = false # Default
max_width = 100
merge_derives = true # Default
newline_style = "Auto" # Default
remove_nested_parens = true # Default
reorder_imports = true # Default
reorder_modules = true # Default
tab_spaces = 2
use_field_init_shorthand = false # Default
use_small_heuristics = "Default" # Default
use_try_shorthand = true

## Features that were "unstable" when we configured them
blank_lines_lower_bound = 0
blank_lines_upper_bound = 3
combine_control_expr = false
comment_width = 100
condense_wildcard_suffixes = true
enum_discrim_align_threshold = 20
error_on_line_overflow = true
error_on_unformatted = false
format_code_in_doc_comments = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
group_imports = "One"
imports_granularity = "Module"
imports_layout = "HorizontalVertical"
match_block_trailing_comma = true
normalize_comments = false
normalize_doc_attributes = true
skip_children = false
spaces_around_ranges = true
struct_field_align_threshold = 0
wrap_comments = true
1 change: 1 addition & 0 deletions source/extensions/dynamic_modules/sdk/rust/rustfmt.toml
Loading

0 comments on commit 22e7328

Please sign in to comment.