This branch contains a number of small fixes for several clippy lints:
00f5715 Add Slice::is_empty() method
Clippy lints about types which have a public len method but no
corresponding is_empty method. Therefore, I've added an is_empty
method that returns true if self.len() > 0.
Since this is a new API that we'll have to support, it would also be
fine to solve this by not adding the method and just suppressing the
warning...but it seems worth having for consistency with the
underlying slice's methods? And, I don't see how this could really
pose a forward-compatibility hazard, since Slice is...always going
to be backed by an actual slice...
fb8c985 don't call clone on Value, which is Copy
dd3018e fix clippy lints about static lifetimes
Clippy lints on explicitly using the 'static lifetime for values in
a static, and when passing a reference to a reference that is
automatically dereferenced (into a single reference) by the compiler.
This commit fixes those lints.
fbc5daa silence clippy warning on approximate values of pi
c81f5b9 silence warning on non-epsilon float comparisons
The tests will make assertions that particular values are recorded in
a particular order. When testing with floating-point values, clippy
emits a warning that we should be using epsilon comparisons rather
than bit equality. However, this isn't an issue here, since the tests
just using float literals, and if the right float is recorded in the
right order, they will be precisely equal.
0e12f69 Fix clippy::drop_ref lint
Clippy doesn't like calls to std::mem::drop with references ---
since the pointed value is not actually dropped. In this case, this
is the correct behavior, but clippy views this as a footgun if the
user means to actually drop the value behind the reference.
Here, we're using drop to ignore values in no-op default impls for
trait methods. I've changed those methods to use let _ to ignore
parameters instead. This doesn't trigger the clippy lint and is maybe
more idiomatic anyway.
This branch contains a number of small fixes for several clippy lints:
00f5715 Add
Slice::is_empty()
methodClippy lints about types which have a public
len
method but no correspondingis_empty
method. Therefore, I've added anis_empty
method that returnstrue
ifself.len() > 0
.Since this is a new API that we'll have to support, it would also be fine to solve this by not adding the method and just suppressing the warning...but it seems worth having for consistency with the underlying slice's methods? And, I don't see how this could really pose a forward-compatibility hazard, since
Slice
is...always going to be backed by an actual slice...fb8c985 don't call
clone
onValue
, which isCopy
dd3018e fix clippy lints about static lifetimes
Clippy lints on explicitly using the
'static
lifetime for values in a static, and when passing a reference to a reference that is automatically dereferenced (into a single reference) by the compiler. This commit fixes those lints.fbc5daa silence clippy warning on approximate values of pi
c81f5b9 silence warning on non-epsilon float comparisons
The tests will make assertions that particular values are recorded in a particular order. When testing with floating-point values, clippy emits a warning that we should be using epsilon comparisons rather than bit equality. However, this isn't an issue here, since the tests just using float literals, and if the right float is recorded in the right order, they will be precisely equal.
0e12f69 Fix
clippy::drop_ref
lintClippy doesn't like calls to
std::mem::drop
with references --- since the pointed value is not actually dropped. In this case, this is the correct behavior, but clippy views this as a footgun if the user means to actually drop the value behind the reference.Here, we're using
drop
to ignore values in no-op default impls for trait methods. I've changed those methods to uselet _
to ignore parameters instead. This doesn't trigger the clippy lint and is maybe more idiomatic anyway.