From 2c5e8cc422fda11a75163273cad1272d3602e0ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 20:27:58 +0000 Subject: [PATCH 1/4] Initial plan From e25e19a23760c72cfd29d88643a57a1a2b44660e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 20:32:56 +0000 Subject: [PATCH 2/4] Add guidance for searching multi-line function call chains in Rust Co-authored-by: heaths <1532486+heaths@users.noreply.github.com> --- .github/copilot-instructions.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 63ff6981e7..80cec3f062 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -47,3 +47,26 @@ Use these instructions for test generation as well. - The `tests` module should always import APIs from `super`. - Do not begin test function names with "test" unless necessary to disambiguate from the function being tested. - Test functions do not need to be public. + +## Searching for Code Patterns + +When searching for function call chains in Rust code, be aware that rustfmt often formats method chains across multiple lines: + +- **Single-line format**: `obj.foo().bar().baz()` +- **Multi-line format** (rustfmt style): + ```rust + obj + .foo() + .bar() + .baz() + ``` + +When using `grep` or similar tools to search for function call chains: + +- **Don't assume** call chains are on a single line. +- **Use multi-line search** patterns when possible (e.g., `rg` with `-U` flag for multi-line search, or `pcregrep` with `-M`). +- **Consider using AST-based tools** like `ast-grep` or `rust-analyzer` for more reliable pattern matching. +- **Search for individual method names** rather than complete call chains if you need to use simple grep. +- **Example with ripgrep**: `rg -U 'obj\s*\.\s*foo\(\)\s*\.\s*bar\(\)'` to match across whitespace and newlines. + +Remember that Rust code in this repository follows rustfmt conventions, which means method chains with 2+ calls are typically formatted with each method on its own line. From ce3e1c621719420b9ca5c4614486955f60d66a85 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 21:06:47 +0000 Subject: [PATCH 3/4] Condense searching guidance into single bullet point Co-authored-by: heaths <1532486+heaths@users.noreply.github.com> --- .github/copilot-instructions.md | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 80cec3f062..588c1ca5ff 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -37,6 +37,7 @@ Use these instructions for test generation as well. - If you have trouble generating safe, efficient, maintainable, and lint-free code, insert a `TODO` comment describing what should happen. - All imported types, constants, functions, modules, and macros should be imported explicitly. Never import `*`. - Do not modify generated code, found in `generated` subdirectories. These files are generated by external tools and should not be edited manually. +- When searching for function call chains in Rust code, be aware that rustfmt often formats method chains across multiple lines like `obj\n .foo()\n .bar()`. Use multi-line search patterns (e.g., `rg` with `-U` flag) or search for individual method names rather than complete call chains. ## Test Generation @@ -47,26 +48,3 @@ Use these instructions for test generation as well. - The `tests` module should always import APIs from `super`. - Do not begin test function names with "test" unless necessary to disambiguate from the function being tested. - Test functions do not need to be public. - -## Searching for Code Patterns - -When searching for function call chains in Rust code, be aware that rustfmt often formats method chains across multiple lines: - -- **Single-line format**: `obj.foo().bar().baz()` -- **Multi-line format** (rustfmt style): - ```rust - obj - .foo() - .bar() - .baz() - ``` - -When using `grep` or similar tools to search for function call chains: - -- **Don't assume** call chains are on a single line. -- **Use multi-line search** patterns when possible (e.g., `rg` with `-U` flag for multi-line search, or `pcregrep` with `-M`). -- **Consider using AST-based tools** like `ast-grep` or `rust-analyzer` for more reliable pattern matching. -- **Search for individual method names** rather than complete call chains if you need to use simple grep. -- **Example with ripgrep**: `rg -U 'obj\s*\.\s*foo\(\)\s*\.\s*bar\(\)'` to match across whitespace and newlines. - -Remember that Rust code in this repository follows rustfmt conventions, which means method chains with 2+ calls are typically formatted with each method on its own line. From eac7aabe9cd8b69ff0d8afc00304abb77823d9b9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 21:53:46 +0000 Subject: [PATCH 4/4] Add rustfmt to cspell.json word list Co-authored-by: heaths <1532486+heaths@users.noreply.github.com> --- .vscode/cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 5a5594b32a..fcacec234c 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -71,6 +71,7 @@ "pwsh", "reqwest", "runtimes", + "rustfmt", "rustup", "schannel", "seekable",