fix_getters_utils/
identification_mode.rs

1//! Getter identification mode.
2
3/// Mode to be used for getter identification.
4#[non_exhaustive]
5#[derive(Clone, Copy, Debug, PartialEq)]
6pub enum IdentificationMode {
7    /// Apply conservative rules:
8    /// * The function is a method. This excludes standalone functions or associated
9    ///   functions.
10    /// * The function accepts no arguments besides `&['_][mut] self`. The methods which
11    ///   accept other arguments are not `getter`s in the sense that they usually don't
12    ///   return current value of a field and renaming them would harm the semantic.
13    ///   Functions consuming `self` were also considered not eligible for renaming.
14    /// * The function accepts no type parameter (lifetimes are accepted). The reason is
15    ///   the same as for functions accepting multiple arguments (see above).
16    Conservative,
17    /// Apply name rules to all function with the `get` prefix.
18    AllGetFunctions,
19}
20
21impl IdentificationMode {
22    pub fn is_conservative(self) -> bool {
23        matches!(self, IdentificationMode::Conservative)
24    }
25}