Most char API should use Copy instead of Ref
behnam opened this issue · 0 comments
behnam commented
Most functions taking char
as input, specially those taking self
with a small struct only having one or two char
, should be migrated to take self
instead of &self
.
Some of the clippy warnings:
warning: this argument is passed by reference, but would be more efficient if passed by value
--> unic/char/range/src/range.rs:180:21
|
180 | pub fn contains(&self, ch: char) -> bool {
| ^^^^^ help: consider passing by value instead: `self`
|
= note: #[warn(clippy::trivially_copy_pass_by_ref)] on by default
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref
warning: this argument is passed by reference, but would be more efficient if passed by value
--> unic/char/range/src/range.rs:190:21
|
190 | pub fn cmp_char(&self, ch: char) -> Ordering {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref
warning: this argument is passed by reference, but would be more efficient if passed by value
--> unic/char/range/src/range.rs:203:16
|
203 | pub fn len(&self) -> usize {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref
warning: this argument is passed by reference, but would be more efficient if passed by value
--> unic/char/range/src/range.rs:208:21
|
208 | pub fn is_empty(&self) -> bool {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref
warning: this argument is passed by reference, but would be more efficient if passed by value
--> unic/char/range/src/range.rs:213:17
|
213 | pub fn iter(&self) -> CharIter {
| ^^^^^ help: consider passing by value instead: `self`
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref