diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-12-05 23:47:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-05 23:47:11 +0100 |
| commit | 5a9c9ef54115a27a3eac4e39feb133e33870b145 (patch) | |
| tree | 5856ef55af3f29e8f02fd6da38f4dadcf7736123 /tests | |
| parent | e941e73368866d3ecc98f040d9f1376de7efcdf1 (diff) | |
| parent | 536516f949ff37b0e10eaed835c2d3592d03e576 (diff) | |
| download | rust-5a9c9ef54115a27a3eac4e39feb133e33870b145.tar.gz rust-5a9c9ef54115a27a3eac4e39feb133e33870b145.zip | |
Rollup merge of #133821 - Kobzol:replace-black-with-ruff, r=onur-ozkan
Replace black with ruff in `tidy` `ruff` can both lint and format Python code (in fact, it should be a mostly drop-in replacement for `black` in terms of formatting), so it's not needed to use `black` anymore. This PR removes `black` and replaces it with `ruff`, to get rid of one Python dependency, and also to make Python formatting faster (although that's a small thing). If we decide to merge this, we'll need to "reformat the world" - `ruff` is not perfectly compatible with `black`, and it also looks like `black` was actually ignoring some files before. I tried it locally (`./x test tidy --extra-checks=py:fmt --bless`) and it also reformatted some code in subtrees (e.g. `clippy` or `rustc_codegen_gcc`) - I'm not sure how to handle that.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py | 3 | ||||
| -rw-r--r-- | tests/debuginfo/embedded-visualizer-point.py | 3 | ||||
| -rw-r--r-- | tests/debuginfo/embedded-visualizer.py | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py index 2635ed487c8..9e801699fcc 100644 --- a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py @@ -1,5 +1,6 @@ import gdb + class PersonPrinter: "Print a Person" @@ -11,6 +12,7 @@ class PersonPrinter: def to_string(self): return "{} is {} years old.".format(self.name, self.age) + def lookup(val): lookup_tag = val.type.tag if lookup_tag is None: @@ -20,4 +22,5 @@ def lookup(val): return None + gdb.current_objfile().pretty_printers.append(lookup) diff --git a/tests/debuginfo/embedded-visualizer-point.py b/tests/debuginfo/embedded-visualizer-point.py index d6b1af00785..5f42957b1f8 100644 --- a/tests/debuginfo/embedded-visualizer-point.py +++ b/tests/debuginfo/embedded-visualizer-point.py @@ -1,5 +1,6 @@ import gdb + class PointPrinter: "Print a Point" @@ -11,6 +12,7 @@ class PointPrinter: def to_string(self): return "({}, {})".format(self.x, self.y) + def lookup(val): lookup_tag = val.type.tag if lookup_tag is None: @@ -20,4 +22,5 @@ def lookup(val): return None + gdb.current_objfile().pretty_printers.append(lookup) diff --git a/tests/debuginfo/embedded-visualizer.py b/tests/debuginfo/embedded-visualizer.py index 8e4fab61614..5fdbbda2188 100644 --- a/tests/debuginfo/embedded-visualizer.py +++ b/tests/debuginfo/embedded-visualizer.py @@ -1,5 +1,6 @@ import gdb + class LinePrinter: "Print a Line" @@ -11,6 +12,7 @@ class LinePrinter: def to_string(self): return "({}, {})".format(self.a, self.b) + def lookup(val): lookup_tag = val.type.tag if lookup_tag is None: @@ -20,4 +22,5 @@ def lookup(val): return None + gdb.current_objfile().pretty_printers.append(lookup) |
