1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! Extraction pattern for milestone 17 (lib.rs decomposition).
//!
//! This module will contain extracted tool handler logic as free functions,
//! keeping the `#[tool(...)]`-decorated methods in `lib.rs` as thin shims.
//! The pattern ensures a smooth, incremental decomposition with no single
//! large-bang refactor.
//!
//! Pattern rules
//! -------------
//!
//! (a) **Extracted handlers are free functions, not methods.** Each handler
//! is a plain `pub(crate) fn` in this module, not an `impl CodeAnalyzer`
//! method. This breaks the coupling to `&self` and makes the function
//! testable in isolation.
//!
//! (b) **Explicit parameters instead of `&self`.** State that the handler
//! needs (e.g., `config: &Config`, `state: &HandlerState`) is passed
//! explicitly as function parameters. The shim in `lib.rs` extracts
//! values from `&self` before calling the extracted function.
//!
//! (c) **`#[tool(...)]`-decorated method and `#[instrument(...)]` decorator
//! remain in `lib.rs` as thin shims.** The `#[tool(..)]` attribute
//! macro and the outer `#[instrument(..)]` stay on the small stub in
//! `lib.rs`. The stub validates parameters, extracts state, and
//! delegates to the free function here.
//!
//! (d) **The extracted free function also carries `#[instrument(skip(...))]`
//! on its own signature.** This preserves distributed tracing context
//! after the call leaves the `lib.rs` shim. Use `skip` for large
//! internal types whose fields are not useful trace attributes.
//!
//! (e) **`edit_failure_counts` stays in `CodeAnalyzer` and is passed by
//! reference to extracted edit handlers.** The concurrent failure-tracking
//! map is not moved into `tools/`; it remains an `Arc<Mutex<...>>` field
//! on `CodeAnalyzer`. Extracted edit handlers receive `&edit_failure_counts`
//! as a parameter.
//!
//! (f) **`#[tool_router]` and `#[tool_handler]` impl blocks remain in
//! `lib.rs` permanently.** The `#[tool_router]` impl on `CodeAnalyzer`
//! and the `#[tool_handler]` impl for `ServerHandler` must not be
//! moved into this module. They are the framework glue that ties all
//! tools together and must live in the crate root.
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub use AnalyzeModuleContext;
pub use AnalyzeSymbolContext;
use AnalysisCache;
use HashMap;
use ;
/// Shared handler context passed to extracted edit tool free functions.
///
/// Bundles the state extracted from `CodeAnalyzer` so the extracted functions
/// stay within clippy's `too_many_arguments` limit while keeping parameters explicit.
pub
/// Shared handler context passed to extracted `analyze_directory` free functions.
///
/// Bundles the `CodeAnalyzer` fields needed by `handle_overview_mode` and
/// `analyze_directory_handler`, keeping them explicit without coupling to `&self`.
pub
/// Per-call metadata passed to `analyze_directory_handler`.
///
/// Bundles the call-site values (timing, identity, request context) so the
/// handler stays within `clippy::too_many_arguments` (7 args max).
pub
/// Shared handler context passed to extracted `analyze_file` free functions.
///
/// Bundles the `CodeAnalyzer` fields needed by `handle_file_details_mode` and
/// `analyze_file_handler`, keeping them explicit without coupling to `&self`.
pub
/// Per-call metadata passed to `analyze_symbol_handler`.
///
/// Bundles the call-site values so the handler stays within
/// `clippy::too_many_arguments` (7 args max).
pub