Skip to content

Commit d6af0b6

Browse files
committed
feat: reorganize Rust code style guidelines in AGENTS.md for clarity, no expect, panic
1 parent 1e60475 commit d6af0b6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

AGENTS.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
- All modules, classes, and functions should include docstrings.
1818
- Tests must use descriptive function names, pytest style assertions, and be
1919
grouped in classes when appropriate.
20-
- Rust code must pass `cargo fmt`, `cargo clippy`, and `cargo tomlfmt` and
21-
should omit unnecessary parentheses around `if` conditions.
20+
- Rust code must pass `cargo fmt`, `cargo clippy`, and `cargo tomlfmt`.
2221
- Install the pre-commit hooks with `pre-commit install` and run them with
2322
`pre-commit run --files <file1> <file2>` or `pre-commit run --all-files`.
2423

@@ -36,6 +35,18 @@ If installation is blocked by a proxy, see the [offline installation guide](http
3635
- `./ci/scripts/rust_clippy.sh`
3736
- `./ci/scripts/rust_toml_fmt.sh`
3837

38+
## Rust Code Style
39+
40+
When generating Rust code for DataFusion, follow these guidelines:
41+
42+
1. Do not add unnecessary parentheses around `if` conditions:
43+
- Correct: `if some_condition`
44+
- Incorrect: `if (some_condition)`
45+
46+
2. Do not use `expect()` or `panic!()` except in tests - use proper error handling with `Result` types
47+
48+
3. Follow the standard Rust style conventions from rustfmt
49+
3950
## Code Organization
4051
- Keep functions focused and under about 50 lines.
4152
- Break complex tasks into well-named helper functions and reuse existing

0 commit comments

Comments
 (0)