aatxe / irc

the irc crate – usable, async IRC for Rust
Mozilla Public License 2.0
528 stars 97 forks source link

Remove unnecessary [..] #137

Closed freddyb closed 6 years ago

freddyb commented 6 years ago

Replaces (&self[..]).strip_formatting() with (&self).strip_formatting() in impl FormattedStringExt for String

aatxe commented 6 years ago

Looks good to me, thanks!

Kroisse commented 6 years ago

On rustc 1.28.0, this change raises a warning like below.

warning: function cannot return without recurring
   --> src/proto/colors.rs:104:5
    |
104 |     fn is_formatted(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
105 |         (&self).is_formatted()
    |         ---------------------- recursive call site
    |
    = note: #[warn(unconditional_recursion)] on by default
    = help: a `loop` may express intention better if this is on purpose

warning: function cannot return without recurring
   --> src/proto/colors.rs:107:5
    |
107 |     fn strip_formatting(&self) -> Cow<str> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recurring
108 |         (&self).strip_formatting()
    |         -------------------------- recursive call site
    |
    = help: a `loop` may express intention better if this is on purpose