Skip to content

ignore_tail_expr_idents 機能の実装#47

Merged
anotherhollow1125 merged 17 commits intomainfrom
feat/not-tail-expr-idents
Sep 25, 2025
Merged

ignore_tail_expr_idents 機能の実装#47
anotherhollow1125 merged 17 commits intomainfrom
feat/not-tail-expr-idents

Conversation

@anotherhollow1125
Copy link
Owner

@anotherhollow1125 anotherhollow1125 commented Sep 23, 2025

📌 Overview / 概要

表題の通り。 tail_expr_idents に入っていない場合でも return_types が合致している場合などに Ok にフックが入ってしまう問題があった。

return_types に合致するために、末尾Exprやreturnがフック対象である時でも、 ignore_tail_expr_idents に含まれる場合はフックしないようにした

⚙ Changes / 変更点

  • ignore_tail_expr_idents 関係の実装
  • ignore_tail_expr_idents 関係のテストの作成・修正
  • ドキュメントの更新
  • バージョンアップ 0.1.1 -> 0.1.2

🧪 Tests / テスト

  • 既存のテストの修正
  • ignore_tail_expr_idents 機能を直接試すテストの追加
    • hooq-macros/tests/special/inert_attr_setting/result_types.rs
  • ignore_tail_expr_idents 機能の効果を検証するようにテストを修正
    • hooq-macros/tests/special/inert_attr_setting/ignore_tail_expr_idents.rs

📚 Related Issues / 関連Issue

todo.md 記載の内容

✅ Checklist

  • I’ve added or updated tests. (必要なテストを用意しました)
  • I’ve updated documentation or comments if needed. (必要に応じてドキュメント/コメントを更新しました)
  • I’ve considered backward compatibility (if public API is changed). (公開されているAPIが変化する場合、後方互換性に配慮しました)
    • 挙動が変わる仕様が含まれるが、本クレートはまだ広く使われていないので問題ないと思われる
    • マイナーバージョンは変更している

@anotherhollow1125 anotherhollow1125 marked this pull request as ready for review September 23, 2025 16:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the ignore_tail_expr_idents feature that allows specifying identifiers to ignore during hooking, even when they match other hook criteria like result_types or tail_expr_idents. The feature helps provide more granular control over which expressions get hooked.

Key changes:

  • Added ignore_tail_expr_idents configuration option that works as a blacklist for tail expressions
  • Enhanced tail expression hooking logic to respect the ignore list while maintaining existing behavior
  • Updated tests to verify the new functionality works correctly with both standalone usage and integration with existing features

Reviewed Changes

Copilot reviewed 148 out of 150 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
todo.md Updated task tracking for the completed feature implementation
hooq/docs/ja/README.md Updated Japanese documentation with new version info and enhanced examples
hooq/docs/README.md Updated English documentation with new version info and enhanced examples
hooq/Cargo.toml Version bump to 0.1.2 and dependency updates
hooq-macros/tests/walker/* Changed test expectations from Ok to Err to accommodate new default behavior
hooq-macros/tests/special/* Updated tests with ignore_tail_expr_idents usage and version changes
hooq-macros/src/impls/walker/mod.rs Core logic changes to support ignore list in tail expression hooking
hooq-macros/src/impls/walker/hook_expr.rs Extracted hook expression logic into separate module
hooq-macros/src/impls/inert_attr/parse.rs Added parsing support for ignore_tail_expr_idents and "!" prefix notation
hooq-macros/src/impls/inert_attr/context.rs Added context methods for checking ignore list patterns
hooq-macros/src/impls/flavor/* Updated flavor system to support the new configuration option
Cargo.toml Workspace version bump to 0.1.2

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 148 out of 150 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

mask_project_root が指定したパス以下のファイルすべてを見ていたために問題を起こしていたので、
指定したパス直下のファイルのみを対象にするように修正した
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 149 out of 151 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

hooq-macros/tests/walker/expr/binary.expanded.rs:43

  • The expanded test output shows that the hook method was removed entirely from this function's tail expression. This suggests the ignore_tail_expr_idents feature is working, but the test should verify this behavior explicitly rather than just checking compilation.
            + c()
                .inspect(|_| {
                    {
                        ::std::io::_print(format_args!("tag: {0}\n", "(no tag)"));
                    };
                })?,

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@anotherhollow1125 anotherhollow1125 merged commit 980221f into main Sep 25, 2025
3 checks passed
@anotherhollow1125 anotherhollow1125 deleted the feat/not-tail-expr-idents branch September 25, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants