Debian Codegraph @

src/function.rs

raw symbols SCIP
1 //! Would-be-getter renaming rules definition.
2
3 use once_cellrust-analyzer cargo once_cell 1.21.4 crate/::syncrust-analyzer cargo once_cell 1.21.4 sync/::Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{
5 collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#},
6 errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#,
7 fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#},
8 };
9
10 use craterust-analyzer cargo fix-getters-rules 0.3.2 crate/::{NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#, NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#, ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#};
11
12 /// Getters reserved suffix list.
13 ///
14 /// Getter that we don't want to rename because
15 /// they are Rust keywords or would result confusing.
16 pub static RESERVEDrust-analyzer cargo fix-getters-rules 0.3.2 function/RESERVED.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<&'static str>> = Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
17 let mut reserved = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
18 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("");
19 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("as");
20 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("const"); // keep `get_const` similar to `get`
21 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("else");
22 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("false");
23 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("for");
24 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("if");
25 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("in");
26 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("mut"); // keep `get_mut` similar to `get`
27 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("optional"); // keep `get_optional` similar to `get`
28 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("or_init"); // keep `get_or_init`
29 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("owned"); // keep `get_owned` similar to `get`
30 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("ref"); // keep `get_ref` similar to `get`
31 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("some"); // keep `get_some` similar to `get`
32 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("true");
33 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("unchecked");
34 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("unchecked_mut");
35 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("where");
36 reserved.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("while");
37 reserved
38 });
39
40 /// Substitutes to be used when the suffix matches exactly.
41 ///
42 /// The convention is to rename getters `get_suffix` as `suffix`,
43 /// but there are cases for which a better name should be used:
44 ///
45 /// - `get_type` -> `type_`.
46 pub static EXACT_SUFFIX_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/EXACT_SUFFIX_SUBSTITUTES.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'static str, &'static str>> = Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
47 let mut exact_subs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
48 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("async", "async_");
49 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("await", "await_");
50 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("break", "break_");
51 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("crate", "crate_");
52 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("continue", "continue_");
53 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("dyn", "dyn_");
54 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("enum", "enum_");
55 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("extern", "extern_");
56 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("fn", "fn_");
57 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("impl", "impl_");
58 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("loop", "loop_");
59 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("match", "match_");
60 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("mod", "mod_");
61 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("move", "move_");
62 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("pub", "pub_");
63 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("return", "return_");
64 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("self", "self_");
65 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("static", "static_");
66 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("struct", "struct_");
67 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("super", "super_");
68 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("trait", "trait_");
69 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("type", "type_");
70 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("union", "union_");
71 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("unsafe", "unsafe_");
72 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("use", "use_");
73 exact_subs
74 });
75
76 /// Substitutes for tokens of `bool` getters.
77 ///
78 /// The convention is to rename `bool` getters `get_suffix` as `is_suffix`,
79 /// but there are cases for which we want a better name:
80 ///
81 /// - `get_mute` -> `is_muted`.
82 /// - `get_emit_eos` -> `emits_eos`.
83 pub static BOOL_FIRST_TOKEN_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_FIRST_TOKEN_SUBSTITUTES.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'static str, &'static str>> =
84 Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
85 let mut first_token_subs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
86 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("activate", "activates");
87 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("accept", "accepts");
88 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("allow", "allows");
89 // Ex.: `get_always_show_image` -> `must_always_show_image`.
90 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("always", "must_always");
91 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("close", "closes");
92 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("create", "creates");
93 // Ex.: `get_destroy_with_parent` -> `must_destroy_with_parent`.
94 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("destroy", "must_destroy");
95 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("do", "does");
96 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("draw", "draws");
97 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("embed", "embeds");
98 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("emit", "emits");
99 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("enable", "enables");
100 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("exit", "exits");
101 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("expand", "expands");
102 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("fill", "fills");
103 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("fit", "fits");
104 // Ex.: `get_focus_on_map` -> `gets_focus_on_map`.
105 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("focus", "gets_focus");
106 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("follow", "follows");
107 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("hide", "hides");
108 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("ignore", "ignores");
109 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("invert", "inverts");
110 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("mute", "is_muted");
111 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("need", "needs");
112 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("propagate", "propagates");
113 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("populate", "populates");
114 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("receive", "receives");
115 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("reset", "resets");
116 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("require", "requires");
117 // Ex.: `get_reserve_indicator` -> `must_reserve_indicator`.
118 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("reserve", "must_reserve");
119 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("resize", "resizes");
120 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("restrict", "restricts");
121 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("reveal", "reveals");
122 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("select", "selects");
123 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("show", "shows");
124 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("shrink", "shrinks");
125 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("skip", "skips");
126 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("snap", "snaps");
127 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("support", "supports");
128 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("take", "takes");
129 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("track", "tracks");
130 // Ex.: `get_truncate_multiline` -> `must_truncate_multiline`.
131 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("truncate", "must_truncate");
132 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("use", "uses");
133 first_token_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("wrap", "wraps");
134 first_token_subs
135 });
136
137 /// Set of `bool` getter suffix first tokens for which no be prefix should be applied.
138 ///
139 /// The convention is to rename `bool` getters `get_suffix` as `is_suffix`,
140 /// but there are cases for which the meaning makes it useless to add the `is` prefix:
141 ///
142 /// - `get_has_entry` -> `has_entry`.
143 pub static BOOL_FIRST_TOKEN_NO_PREFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_FIRST_TOKEN_NO_PREFIX.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<&'static str>> = Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
144 let mut first_tokens = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
145 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("can");
146 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("has");
147 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("must");
148 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("should");
149 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("state");
150 // Also add all the prefix substitutes (e.g. accepts, skips, ...)
151 for bool_substitute in BOOL_FIRST_TOKEN_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_FIRST_TOKEN_SUBSTITUTES..valuesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values().() {
152 first_tokens.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(bool_substitute);
153 }
154 first_tokens
155 });
156
157 /// Substitutes of `bool` getter to be used when the suffix matches exactly.
158 ///
159 /// The convention is to rename `bool` getters `get_suffix` as `is_suffix`,
160 /// but there are cases for which it would be confusing to add the `is` prefix:
161 ///
162 /// - `get_result` -> `result`.
163 /// - `get_overwrite` -> `overwrites`. Note that if the getter suffix doesn't match
164 /// exactly, this rule doesn't apply. Ex. `get_overwrite_mode` -> `is_overwrites_mode`
165 pub static BOOL_EXACT_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_EXACT_SUBSTITUTES.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&'static str, &'static str>> = Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
166 let mut exact_subs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
167 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("result", "result");
168 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("overwrite", "overwrites");
169 exact_subs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("visibility", "is_visible");
170 exact_subs
171 });
172
173 /// Special suffix to detect getters returning a `bool`.
174 ///
175 /// Ex.: `get_seekable`.
176 pub const BOOL_ABLE_PREFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_ABLE_PREFIX.: &str = "able";
177
178 /// Getters prefix to move to the end.
179 ///
180 /// The convention is to use the form:
181 /// - `get_structure_mut`.
182 ///
183 /// but we can run into this one too:
184 /// - `get_mut_structure`.
185 pub static PREFIX_TO_POSTFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/PREFIX_TO_POSTFIX.: Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#<HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<&'static str>> = Lazyrust-analyzer cargo once_cell 1.21.4 sync/Lazy#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`Lazy<T, F>`]new().(|| {
186 let mut prefix_to_postfix = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().();
187 prefix_to_postfix.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().("mut");
188 prefix_to_postfix
189 });
190
191 /// Attempts to apply getter name rules to this would-be-getter function.
192 ///
193 /// The argument `returns_bool` hints the renaming process when
194 /// the getter returns a unique `bool` value. Use [`ReturnsBool::Maybe`]
195 /// if the return value is not known.
196 pub fn try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(
197 name: &str,
198 returns_bool: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#>,
199 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#, RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#> {
200 let suffix = match name.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("get_") {
201 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(suffix) => suffix,
202 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#::NotGetFnrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#NotGetFn#),
203 };
204
205 try_rename_getter_suffixrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_getter_suffix().(suffix, returns_bool)
206 }
207
208 /// Attempts to apply getter name rules to this getter suffix.
209 ///
210 /// The argument `returns_bool` hints the renaming process when
211 /// the getter returns a unique `bool` value. Use [`ReturnsBool::Maybe`]
212 /// if the return value is not known.
213 pub fn try_rename_getter_suffixrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_getter_suffix().(
214 suffix: &str,
215 returns_bool: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#>,
216 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#, RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#> {
217 use ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::*;
218 let returns_bool = match returns_bool.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().() {
219 Falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#False# => ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#False#,
220 Truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#True# => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(suffix)),
221 Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe# => {
222 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rename) = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(suffix) {
223 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rename);
224 }
225 ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#
226 }
227 };
228
229 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(substitute) = EXACT_SUFFIX_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/EXACT_SUFFIX_SUBSTITUTES..getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(suffix) {
230 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
231 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: substitute.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
232 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.,
233 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Substituted#,
234 });
235 }
236
237 let splits: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = suffix.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]splitn().(2, '_').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
238 if splits.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 && PREFIX_TO_POSTFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/PREFIX_TO_POSTFIX..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().) {
239 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
240 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}_{}", splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().),
241 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.,
242 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Fixedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Fixed#,
243 })
244 } else if RESERVEDrust-analyzer cargo fix-getters-rules 0.3.2 function/RESERVED..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(suffix) {
245 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#::Reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#Reserved#)
246 } else {
247 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
248 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: suffix.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
249 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.,
250 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Regular#,
251 })
252 }
253 }
254
255 /// Applies `bool` getter name rules.
256 #[inline]
257 pub fn rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(suffix: &str) -> NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
258 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(substitute) = BOOL_EXACT_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_EXACT_SUBSTITUTES..getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(suffix) {
259 return NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
260 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: substitute.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
261 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
262 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Substituted#,
263 };
264 }
265
266 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_name) = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(suffix) {
267 new_name
268 } else {
269 NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
270 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("is_{}", suffix),
271 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
272 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Regular#,
273 }
274 }
275 }
276
277 /// Attempts to apply special rules to the `bool` getter.
278 ///
279 /// The substitutions are defined in [`BOOL_FIRST_TOKEN_SUBSTITUTES`]
280 /// and [`BOOL_FIRST_TOKEN_NO_PREFIX`].
281 #[inline]
282 fn try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(suffix: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#> {
283 let mut working_suffix = suffix;
284 let mut has_is_prefix = false;
285
286 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(suffix_without_is) = suffix.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("is_") {
287 working_suffix = suffix_without_is;
288 has_is_prefix = true;
289 }
290
291 let splits: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = working_suffix.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]splitn().(2, '_').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
292 BOOL_FIRST_TOKEN_SUBSTITUTESrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_FIRST_TOKEN_SUBSTITUTES.
293 .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)
294 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|substitute| {
295 if splits.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 {
296 NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
297 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: substitute.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
298 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
299 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Substituted#,
300 }
301 } else {
302 NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
303 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}_{}", substitute, splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().),
304 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
305 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Substituted#,
306 }
307 }
308 })
309 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| {
310 BOOL_FIRST_TOKEN_NO_PREFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_FIRST_TOKEN_NO_PREFIX..getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]get().(splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|_| {
311 if splits.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 {
312 NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
313 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
314 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
315 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::NoPrefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#NoPrefix#,
316 }
317 } else {
318 NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
319 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}_{}", splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().),
320 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
321 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::NoPrefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#NoPrefix#,
322 }
323 }
324 })
325 })
326 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| {
327 // No bool rules applied to the working suffix
328 if has_is_prefix {
329 // but the suffix was already `is` prefixed
330 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
331 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: suffix.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
332 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
333 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Regular#,
334 })
335 } else {
336 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
337 }
338 })
339 }
340
341 /// Attempts to determine whether the getter returns a `bool` from its name.
342 ///
343 /// Uses [`BOOL_FIRST_TOKEN_SUBSTITUTES`], [`BOOL_FIRST_TOKEN_NO_PREFIX`] and
344 /// [`BOOL_ABLE_PREFIX`] as a best effort estimation.
345 ///
346 /// Returns the name substitute if `self` seems to be returning a `bool`.
347 #[inline]
348 pub fn guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(suffix: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#> {
349 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_name) = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(suffix) {
350 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_name);
351 }
352
353 let splits: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = suffix.splitnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]splitn().(2, '_').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
354 if splits[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().(BOOL_ABLE_PREFIXrust-analyzer cargo fix-getters-rules 0.3.2 function/BOOL_ABLE_PREFIX.) {
355 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(NewNamerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName# {
356 new_namerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#new_name.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("is_{}", suffix),
357 returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#returns_bool.: true.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
358 rulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewName#rule.: NewNameRulerust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#::Regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/NewNameRule#Regular#,
359 })
360 } else {
361 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
362 }
363 }
364
365 /// Would-be-getter rename attempt failure result.
366 ///
367 /// Holds details about the reason of the failure.
368 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
369 #[non_exhaustive]
370 pub enum RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError# {
371 /// The function doesn't start with `get_`.
372 NotGetFnrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#NotGetFn#,
373 /// The function uses a reserved name and can't be renamed.
374 Reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#Reserved#,
375 }
376
377 impl RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError# {
378 pub fn is_not_get_fnrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_not_get_fn().(&self) -> bool {
379 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self, RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#::NotGetFnrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#NotGetFn#)
380 }
381
382 pub fn is_reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_reserved().(&self) -> bool {
383 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self, RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#::Reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#Reserved#)
384 }
385 }
386
387 impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError# {
388 fn fmtrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#> {
389 use RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#::*;
390 match self {
391 NotGetFnrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#NotGetFn# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "not a get function"),
392 Reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError#Reserved# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "name is reserved"),
393 }
394 }
395 }
396
397 impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for RenameErrorrust-analyzer cargo fix-getters-rules 0.3.2 function/RenameError# {}
398
399 #[cfg(test)]
400 mod testsrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/ {
401 use superrust-analyzer cargo fix-getters-rules 0.3.2 function/::*;
402
403 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
404 fn bool_getter_rename_attemptrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/bool_getter_rename_attempt().() {
405 let new_name = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"mute").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
406 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
407 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
408 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_muted");
409
410 let new_name = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"emit_eos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
411 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
412 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
413 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
414
415 let new_name = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"has_entry").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
416 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_no_prefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_no_prefix().());
417 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
418 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "has_entry");
419
420 let new_name = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"is_emit_eos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
421 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
422 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
423 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
424
425 let new_name = try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"is_activated").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
426 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
427 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
428 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activated");
429
430 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_bool_getter().(&"name").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
431 }
432
433 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
434 fn bool_getter_suffixrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/bool_getter_suffix().() {
435 let new_name = rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(&"result");
436 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
437 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
438 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "result");
439
440 let new_name = rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(&"activable");
441 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
442 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
443 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activable");
444
445 let new_name = rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(&"mute");
446 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
447 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
448 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_muted");
449
450 let new_name = rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(&"emit_eos");
451 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
452 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
453 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
454
455 let new_name = rename_bool_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/rename_bool_getter().(&"can_acquire");
456 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_no_prefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_no_prefix().());
457 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
458 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "can_acquire");
459 }
460
461 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
462 fn boolness_guestimationrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/boolness_guestimation().() {
463 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"result").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
464 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"name").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
465
466 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"mute").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
467 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
468 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_muted");
469
470 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"does_ts").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
471 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
472 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "does_ts");
473
474 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"emit_eos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
475 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
476 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
477
478 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"emits_eos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
479 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
480 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
481
482 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"is_emits_eos").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
483 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
484 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
485
486 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"is_activated").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
487 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
488 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activated");
489
490 let new_name = guesstimate_boolness_then_renamerust-analyzer cargo fix-getters-rules 0.3.2 function/guesstimate_boolness_then_rename().(&"activable").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
491 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
492 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activable");
493 }
494
495 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
496 fn rename_getter_non_boolrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/rename_getter_non_bool().() {
497 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_structure", false).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
498 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
499 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_false().());
500 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "structure");
501
502 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_type", false).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
503 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
504 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_false().());
505 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "type_");
506
507 // Bool-alike, but not a bool
508 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_activable", false).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
509 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
510 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_false().());
511 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "activable");
512
513 // Prefix to postfix
514 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mut_structure", false).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
515 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_fixedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_fixed().());
516 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_falserust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_false().());
517 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "structure_mut");
518
519 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mut", false)
520 .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().()
521 .is_reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_reserved().());
522 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"not_a_getter", false)
523 .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().()
524 .is_not_get_fnrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_not_get_fn().());
525 }
526
527 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
528 fn rename_getter_boolrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/rename_getter_bool().() {
529 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_structure", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
530 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
531 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
532 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_structure");
533
534 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_type", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
535 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
536 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
537 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_type");
538
539 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mute", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
540 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
541 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
542 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_muted");
543
544 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_emit_eos", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
545 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
546 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
547 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
548
549 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_emits_eos", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
550 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_no_prefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_no_prefix().());
551 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
552 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
553
554 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_is_emit_eos", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
555 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
556 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
557 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
558
559 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_is_activated", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
560 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
561 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
562 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activated");
563
564 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_activable", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
565 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
566 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
567 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activable");
568
569 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mut", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
570 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
571 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
572 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_mut");
573
574 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_overwrite", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
575 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
576 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
577 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "overwrites");
578
579 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_overwrite_mode", true).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
580 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
581 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
582 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_overwrite_mode");
583
584 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"not_a_getter", true)
585 .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().()
586 .is_not_get_fnrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_not_get_fn().());
587 }
588
589 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
590 fn rename_getter_maybe_boolrust-analyzer cargo fix-getters-rules 0.3.2 function/tests/rename_getter_maybe_bool().() {
591 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_structure", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
592 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
593 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_maybe().());
594 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "structure");
595
596 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_type", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
597 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
598 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_maybe().());
599 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "type_");
600
601 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mute", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
602 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
603 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
604 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_muted");
605
606 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_emit_eos", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
607 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
608 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
609 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
610
611 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_emits_eos", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
612 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_no_prefixrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_no_prefix().());
613 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
614 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
615
616 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_is_emit_eos", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
617 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_substitutedrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_substituted().());
618 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
619 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "emits_eos");
620
621 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_is_activated", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
622 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
623 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
624 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activated");
625
626 let new_name = try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_activable", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
627 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.is_regularrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]is_regular().());
628 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(new_name.returns_boolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[NewName]returns_bool().().is_truerust-analyzer cargo fix-getters-rules 0.3.2 new_name/impl#[ReturnsBool]is_true().());
629 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(new_name, "is_activable");
630
631 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"get_mut", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#)
632 .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().()
633 .is_reservedrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_reserved().());
634 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
635 try_rename_would_be_getterrust-analyzer cargo fix-getters-rules 0.3.2 function/try_rename_would_be_getter().(&"not_a_getter", ReturnsBoolrust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#::Mayberust-analyzer cargo fix-getters-rules 0.3.2 new_name/ReturnsBool#Maybe#)
636 .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().()
637 .is_not_get_fnrust-analyzer cargo fix-getters-rules 0.3.2 function/impl#[RenameError]is_not_get_fn().()
638 );
639 }
640 }