Libera-Chat / sable

GNU Affero General Public License v3.0
77 stars 8 forks source link

Fix clippy warnings #122

Closed progval closed 2 months ago

progval commented 3 months ago

In addition to #121, I left these issues unfixed because I'm not sure what to do about them:

warning: this function has too many arguments (8/7)
  --> sable_server/src/run.rs:75:1
   |
75 | / async fn do_run_server<ST>(
76 | |     server_conf_path: impl AsRef<Path>,
77 | |     server_config: ServerConfig<ST>,
78 | |     processed_server_config: ST::ProcessedConfig,
...  |
85 | | where
86 | |     ST: ServerType,
   | |___________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: `#[warn(clippy::too_many_arguments)]` on by default

warning: `sable_server` (lib) generated 1 warning
    Checking sable_ircd v0.1.0 (/home/dev-sable/sable/sable_ircd)
warning: you should consider adding a `Default` implementation for `AtomicCapabilitySet`
   --> sable_ircd/src/capability/mod.rs:131:5
    |
131 | /     pub fn new() -> Self {
132 | |         Self(AtomicU64::new(0))
133 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
    = note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
    |
130 + impl Default for AtomicCapabilitySet {
131 +     fn default() -> Self {
132 +         Self::new()
133 +     }
134 + }
    |

warning: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self`
  --> sable_ircd/src/command/plumbing/conditional_argument_types.rs:58:23
   |
58 |     pub fn is_present(self) -> Option<T> {
   |                       ^^^^
   |
   = help: consider choosing a less ambiguous name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
   = note: `#[warn(clippy::wrong_self_convention)]` on by default

warning: this function has too many arguments (8/7)
   --> sable_ircd/src/command/handlers/chathistory.rs:294:1
    |
294 | / fn send_history_for_target_forward(
295 | |     server: &ClientServer,
296 | |     into: impl MessageSink,
297 | |     source: &wrapper::User,
...   |
302 | |     limit: Option<usize>,
303 | | ) -> CommandResult {
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: `#[warn(clippy::too_many_arguments)]` on by default

warning: this function has too many arguments (8/7)
   --> sable_ircd/src/command/handlers/chathistory.rs:332:1
    |
332 | / fn send_history_for_target_reverse(
333 | |     server: &ClientServer,
334 | |     into: impl MessageSink,
335 | |     source: &wrapper::User,
...   |
340 | |     limit: Option<usize>,
341 | | ) -> CommandResult {
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

warning: you should consider adding a `Default` implementation for `AsyncHandlerCollection<'a>`
  --> sable_ircd/src/server/async_handler_collection.rs:10:5
   |
10 | /     pub fn new() -> Self {
11 | |         Self {
12 | |             futures: FuturesUnordered::new(),
13 | |         }
14 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
   |
9  + impl<'a> Default for AsyncHandlerCollection<'a> {
10 +     fn default() -> Self {
11 +         Self::new()
12 +     }
13 + }
   |

warning: `sable_ircd` (lib) generated 5 warnings (run `cargo clippy --fix --lib -p sable_ircd` to apply 2 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 4.16s