riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.02k stars 69 forks source link

Address `cargo clippy` errors and simple warnings #86

Closed sergey-melnychuk closed 4 years ago

sergey-melnychuk commented 4 years ago

Resolved cargo clippy errors and warnings:

warning: redundant field names in struct initialization
   --> src/actor/actor_cell.rs:576:13
    |
576 |             interval: interval,
    |             ^^^^^^^^^^^^^^^^^^ help: replace it with: `interval`
    |
    = note: `#[warn(clippy::redundant_field_names)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/actor/actor_cell.rs:578:13
    |
578 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/actor/actor_cell.rs:604:13
    |
604 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/actor/actor_cell.rs:632:13
    |
632 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/kernel/mailbox.rs:376:25
    |
376 |                         sender: sender,
    |                         ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/kernel/queue.rs:11:28
   |
11 |     let qw = QueueWriter { tx: tx };
   |                            ^^^^^^ help: replace it with: `tx`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> src/kernel/queue.rs:14:9
   |
14 |         rx: rx,
   |         ^^^^^^ help: replace it with: `rx`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/system/system.rs:442:13
    |
442 |             interval: interval,
    |             ^^^^^^^^^^^^^^^^^^ help: replace it with: `interval`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/system/system.rs:444:13
    |
444 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/system/system.rs:470:13
    |
470 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
   --> src/system/system.rs:498:13
    |
498 |             sender: sender,
    |             ^^^^^^^^^^^^^^ help: replace it with: `sender`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: All variants have the same prefix: `Select`
   --> src/actor/selection.rs:191:1
    |
191 | / enum Selection {
192 | |     SelectParent,
193 | |     SelectChildName(String),
194 | |     SelectAllChildren,
195 | | }
    | |_^
    |
    = note: `#[warn(clippy::enum_variant_names)]` on by default
    = help: remove the prefixes and use full paths to the variants instead of glob imports
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

warning: returning the result of a let binding from a block
   --> src/kernel/provider.rs:217:9
    |
215 |         let actor = Guardian { name };
    |         ------------------------------ unnecessary let binding
216 | 
217 |         actor
    |         ^^^^^
    |
    = note: `#[warn(clippy::let_and_return)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
    |
215 |         
216 | 
217 |         Guardian { name }
    |

error: useless lint attribute
 --> src/lib.rs:5:1
  |
5 | #[allow(unused_imports)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(unused_imports)]`
  |
  = note: `#[deny(clippy::useless_attribute)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute

warning: single-character string constant used as pattern
   --> src/actor/actor_cell.rs:524:54
    |
524 |         let (anchor, path_str) = if path.starts_with("/") {
    |                                                      ^^^ help: try using a char instead: `'/'`
    |
    = note: `#[warn(clippy::single_char_pattern)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

warning: using `clone` on a `Copy` type
   --> src/actor/actor_cell.rs:574:17
    |
574 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = note: `#[warn(clippy::clone_on_copy)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: this let-binding has unit value
   --> src/actor/actor_cell.rs:582:9
    |
582 |         let _ = self.system.timer.send(Job::Repeat(job)).unwrap();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `self.system.timer.send(Job::Repeat(job)).unwrap();`
    |
    = note: `#[warn(clippy::let_unit_value)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value

warning: using `clone` on a `Copy` type
   --> src/actor/actor_cell.rs:601:17
    |
601 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: this let-binding has unit value
   --> src/actor/actor_cell.rs:608:9
    |
608 |         let _ = self.system.timer.send(Job::Once(job)).unwrap();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `self.system.timer.send(Job::Once(job)).unwrap();`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value

warning: using `clone` on a `Copy` type
   --> src/actor/actor_cell.rs:629:17
    |
629 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: this let-binding has unit value
   --> src/actor/actor_cell.rs:636:9
    |
636 |         let _ = self.system.timer.send(Job::Once(job)).unwrap();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `self.system.timer.send(Job::Once(job)).unwrap();`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value

warning: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
   --> src/actor/actor_cell.rs:691:21
    |
691 |         let actor = actors.values().skip(self.position).next();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::iter_skip_next)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next

warning: You are using an explicit closure for cloning elements
   --> src/actor/actor_cell.rs:693:9
    |
693 |         actor.map(|a| a.clone())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `actor.cloned()`
    |
    = note: `#[warn(clippy::map_clone)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone

warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
  --> src/actor/channel.rs:72:13
   |
72 | /             match evt {
73 | |                 SystemEvent::ActorTerminated(terminated) => {
74 | |                     let subs = self.subs.clone();
75 | |
...  |
80 | |                 _ => {}
81 | |             }
   | |_____________^
   |
   = note: `#[warn(clippy::single_match)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
help: try this
   |
72 |             if let SystemEvent::ActorTerminated(terminated) = evt {
73 |     let subs = self.subs.clone();
74 | 
75 |     for topic in subs.keys() {
76 |         unsubscribe(&mut self.subs, topic, &terminated.actor);
77 |     }
 ...

warning: usage of `contains_key` followed by `insert` on a `HashMap`
   --> src/actor/channel.rs:109:9
    |
109 | /         if self.subs.contains_key(&msg.topic) {
110 | |             self.subs.get_mut(&msg.topic).unwrap().push(msg.actor);
111 | |         } else {
112 | |             self.subs.insert(msg.topic, vec![msg.actor]);
113 | |         }
    | |_________^ consider using `self.subs.entry(msg.topic)`
    |
    = note: `#[warn(clippy::map_entry)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry

error: you are implementing `Hash` explicitly but have derived `PartialEq`
   --> src/actor/channel.rs:340:1
    |
340 | / impl Hash for Topic {
341 | |     fn hash<H: Hasher>(&self, state: &mut H) {
342 | |         self.0.hash(state);
343 | |     }
344 | | }
    | |_^
    |
    = note: `#[deny(clippy::derive_hash_xor_eq)]` on by default
note: `PartialEq` implemented here
   --> src/actor/channel.rs:335:24
    |
335 | #[derive(Clone, Debug, PartialEq)]
    |                        ^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq

warning: redundant clone
   --> src/actor/channel.rs:354:20
    |
354 |         Topic(topic.to_string())
    |                    ^^^^^^^^^^^^ help: remove this
    |
    = note: `#[warn(clippy::redundant_clone)]` on by default
note: this value is dropped without further use
   --> src/actor/channel.rs:354:15
    |
354 |         Topic(topic.to_string())
    |               ^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: you don't need to add `&` to all patterns
   --> src/actor/channel.rs:360:9
    |
360 | /         match evt {
361 | |             &SystemEvent::ActorCreated(_) => Topic::from("actor.created"),
362 | |             &SystemEvent::ActorTerminated(_) => Topic::from("actor.terminated"),
363 | |             &SystemEvent::ActorRestarted(_) => Topic::from("actor.restarted"),
364 | |         }
    | |_________^
    |
    = note: `#[warn(clippy::match_ref_pats)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
help: instead of prefixing all patterns with `&`, you can dereference the expression
    |
360 |         match *evt {
361 |             SystemEvent::ActorCreated(_) => Topic::from("actor.created"),
362 |             SystemEvent::ActorTerminated(_) => Topic::from("actor.terminated"),
363 |             SystemEvent::ActorRestarted(_) => Topic::from("actor.restarted"),
    |

warning: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
   --> src/actor/props.rs:216:13
    |
216 |         let ref f = self.creator;
    |         ----^^^^^---------------- help: try: `let f = &self.creator;`
    |
    = note: `#[warn(clippy::toplevel_ref_arg)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg

warning: `ref` on an entire `let` pattern is discouraged, take a reference with `&` instead
   --> src/actor/props.rs:265:13
    |
265 |         let ref f = self.creator;
    |         ----^^^^^---------------- help: try: `let f = &self.creator;`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg

warning: writing `&String` instead of `&str` involves a new object where a slice will do.
  --> src/actor/selection.rs:79:19
   |
79 |             path: &String,
   |                   ^^^^^^^ help: change this to: `&str`
   |
   = note: `#[warn(clippy::ptr_arg)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

warning: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
   --> src/actor/selection.rs:103:33
    |
102 |                     if path_vec.peek().is_none() && child.is_some() {
    |                                                     --------------- the check is happening here
103 |                         let _ = child.unwrap().try_tell(msg, sender.clone());
    |                                 ^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::unnecessary_unwrap)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap

warning: writing `&String` instead of `&str` involves a new object where a slice will do.
   --> src/actor/selection.rs:138:19
    |
138 |             path: &String,
    |                   ^^^^^^^ help: change this to: `&str`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

warning: You checked before that `unwrap()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
   --> src/actor/selection.rs:161:25
    |
160 |                     if path_vec.peek().is_none() && child.is_some() {
    |                                                     --------------- the check is happening here
161 |                         child.unwrap().sys_tell(msg);
    |                         ^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap

warning: identical conversion
  --> src/kernel/kernel_ref.rs:65:37
   |
65 |         Err(e) => Err(MsgError::new(e.msg.into())),
   |                                     ^^^^^^^^^^^^ help: consider removing `.into()`: `e.msg`
   |
   = note: `#[warn(clippy::identity_conversion)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion

warning: this loop could be written as a `while let` loop
   --> src/kernel/mailbox.rs:267:5
    |
267 | /     loop {
268 | |         match mbox.sys_try_dequeue() {
269 | |             Ok(sys_msg) => {
270 | |                 sys_msgs.push(sys_msg);
...   |
273 | |         }
274 | |     }
    | |_____^ help: try: `while let Ok(sys_msg) = mbox.sys_try_dequeue() { .. }`
    |
    = note: `#[warn(clippy::while_let_loop)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop

warning: this loop could be written as a `while let` loop
   --> src/kernel/mailbox.rs:370:5
    |
370 | /     loop {
371 | |         match mbox.try_dequeue() {
372 | |             Ok(msg) => match (msg.msg, msg.sender) {
373 | |                 (msg, sender) => {
...   |
392 | |         }
393 | |     }
    | |_____^ help: try: `while let Ok(msg) = mbox.try_dequeue() { .. }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop

warning: redundant clone
  --> src/kernel/provider.rs:65:16
   |
65 |             uri.clone(),
   |                ^^^^^^^^ help: remove this
   |
note: this value is dropped without further use
  --> src/kernel/provider.rs:65:13
   |
65 |             uri.clone(),
   |             ^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
  --> src/kernel/provider.rs:70:23
   |
70 |             sys_sender.clone(),
   |                       ^^^^^^^^ help: remove this
   |
note: this value is dropped without further use
  --> src/kernel/provider.rs:70:13
   |
70 |             sys_sender.clone(),
   |             ^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
  --> src/kernel/provider.rs:71:19
   |
71 |             sender.clone(),
   |                   ^^^^^^^^ help: remove this
   |
note: this value is dropped without further use
  --> src/kernel/provider.rs:71:13
   |
71 |             sender.clone(),
   |             ^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:156:12
    |
156 |         uri.clone(),
    |            ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:156:9
    |
156 |         uri.clone(),
    |         ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:157:21
    |
157 |         Some(bigbang.clone()),
    |                     ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:157:14
    |
157 |         Some(bigbang.clone()),
    |              ^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:161:19
    |
161 |         sys_sender.clone(),
    |                   ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:161:9
    |
161 |         sys_sender.clone(),
    |         ^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:162:15
    |
162 |         sender.clone(),
    |               ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:162:9
    |
162 |         sender.clone(),
    |         ^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:191:12
    |
191 |         uri.clone(),
    |            ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:191:9
    |
191 |         uri.clone(),
    |         ^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:196:19
    |
196 |         sys_sender.clone(),
    |                   ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:196:9
    |
196 |         sys_sender.clone(),
    |         ^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/kernel/provider.rs:197:15
    |
197 |         sender.clone(),
    |               ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/kernel/provider.rs:197:9
    |
197 |         sender.clone(),
    |         ^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/system/logger.rs:121:65
    |
121 |             time_fmt: config.get_str("log.time_format").unwrap().to_string(),
    |                                                                 ^^^^^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/system/logger.rs:121:23
    |
121 |             time_fmt: config.get_str("log.time_format").unwrap().to_string(),
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/system/logger.rs:122:65
    |
122 |             date_fmt: config.get_str("log.date_format").unwrap().to_string(),
    |                                                                 ^^^^^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/system/logger.rs:122:23
    |
122 |             date_fmt: config.get_str("log.date_format").unwrap().to_string(),
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: redundant clone
   --> src/system/logger.rs:123:63
    |
123 |             log_fmt: config.get_str("log.log_format").unwrap().to_string(),
    |                                                               ^^^^^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> src/system/logger.rs:123:22
    |
123 |             log_fmt: config.get_str("log.log_format").unwrap().to_string(),
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone

warning: use of `unwrap_or` followed by a function call
   --> src/system/logger.rs:126:18
    |
126 |                 .unwrap_or(vec![])
    |                  ^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| vec![])`
    |
    = note: `#[warn(clippy::or_fun_call)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: you should consider deriving a `Default` implementation for `system::system::SystemBuilder`
  --> src/system/system.rs:53:5
   |
53 | /     pub fn new() -> Self {
54 | |         SystemBuilder {
55 | |             name: None,
56 | |             cfg: None,
...  |
59 | |         }
60 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
45 | #[derive(Default)]
   |

warning: use of `unwrap_or` followed by a function call
  --> src/system/system.rs:63:28
   |
63 |         let cfg = self.cfg.unwrap_or(load_config());
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(load_config)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: use of `unwrap_or` followed by a function call
  --> src/system/system.rs:64:30
   |
64 |         let exec = self.exec.unwrap_or(default_exec(&cfg));
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| default_exec(&cfg))`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: use of `unwrap_or` followed by a function call
  --> src/system/system.rs:65:28
   |
65 |         let log = self.log.unwrap_or(default_log(&cfg));
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| default_log(&cfg))`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: using `clone` on a `Copy` type
   --> src/system/system.rs:233:9
    |
233 |         self.proto.id.clone()
    |         ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.proto.id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: single-character string constant used as pattern
   --> src/system/system.rs:373:54
    |
373 |         let (anchor, path_str) = if path.starts_with("/") {
    |                                                      ^^^ help: try using a char instead: `'/'`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

warning: using `clone` on a `Copy` type
   --> src/system/system.rs:440:17
    |
440 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on a `Copy` type
   --> src/system/system.rs:467:17
    |
467 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: using `clone` on a `Copy` type
   --> src/system/system.rs:495:17
    |
495 |             id: id.clone(),
    |                 ^^^^^^^^^^ help: try removing the `clone` call: `id`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

warning: use of `unwrap_or` followed by a function call
  --> src/lib.rs:38:39
   |
38 |     let path = env::var("RIKER_CONF").unwrap_or("config/riker.toml".into());
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| "config/riker.toml".into())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: useless use of `format!`
  --> src/lib.rs:39:32
   |
39 |     cfg.merge(File::with_name(&format!("{}", path)).required(false))
   |                                ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `path.to_string()`
   |
   = note: `#[warn(clippy::useless_format)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

warning: use of `unwrap_or` followed by a function call
  --> src/lib.rs:44:37
   |
44 |     let path = env::var("APP_CONF").unwrap_or("config/app".into());
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| "config/app".into())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

warning: useless use of `format!`
  --> src/lib.rs:45:32
   |
45 |     cfg.merge(File::with_name(&format!("{}", path)).required(false))
   |                                ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `path.to_string()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format

warning: You are using an explicit closure for cloning elements
  --> src/lib.rs:95:50
   |
95 |                 Some(ref m) if m.is::<T>() => Ok(m.downcast_ref::<T>().map(|t| t.clone()).unwrap()),
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `m.downcast_ref::<T>().cloned()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone

Remaining cargo clippy warnings:

    Checking riker v0.3.2 (/Users/sergey/Temp/riker)
warning: module has the same name as its containing module
 --> src/actor/mod.rs:1:1
  |
1 | pub(crate) mod actor;
  | ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(clippy::module_inception)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception

warning: module has the same name as its containing module
 --> src/kernel/mod.rs:1:1
  |
1 | pub(crate) mod kernel;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception

warning: module has the same name as its containing module
 --> src/system/mod.rs:2:1
  |
2 | pub(crate) mod system;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception

warning: you should consider deriving a `Default` implementation for `actor::channel::Channel<Msg>`
  --> src/actor/channel.rs:35:5
   |
35 | /     pub fn new() -> Self {
36 | |         Channel {
37 | |             subs: HashMap::new(),
38 | |         }
39 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::new_without_default)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
27 | #[derive(Default)]
   |

warning: you should consider adding a `Default` implementation for `actor::channel::EventsChannel`
   --> src/actor/channel.rs:178:5
    |
178 | /     pub fn new() -> Self {
179 | |         EventsChannel(Channel::new())
180 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
    |
177 | impl Default for actor::channel::EventsChannel {
178 |     fn default() -> Self {
179 |         Self::new()
180 |     }
181 | }
    |

warning: methods called `new` usually return `Self`
  --> src/actor/props.rs:47:5
   |
47 | /     pub fn new<A, F>(creator: F) -> Arc<Mutex<impl ActorProducer<Actor = A>>>
48 | |     where
49 | |         A: Actor + Send + 'static,
50 | |         F: Fn() -> A + Send + 'static,
51 | |     {
52 | |         Arc::new(Mutex::new(ActorProps::new(creator)))
53 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::new_ret_no_self)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self

warning: methods called `new` usually return `Self`
   --> src/actor/props.rs:199:5
    |
199 | /     pub fn new<F>(creator: F) -> impl ActorProducer<Actor = A>
200 | |     where
201 | |         F: Fn() -> A + Send + 'static,
202 | |     {
...   |
205 | |         }
206 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self

warning: methods called `new` usually return `Self`
   --> src/actor/props.rs:246:5
    |
246 | /     pub fn new<F>(creator: F, args: Args) -> impl ActorProducer<Actor = A>
247 | |     where
248 | |         F: Fn(Args) -> A + Send + 'static,
249 | |     {
...   |
253 | |         }
254 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_ret_no_self

    Finished dev [unoptimized + debuginfo] target(s) in 1.35s
olexiyb commented 4 years ago

merged this change into actors.rs fork