First pass at fixing clippy::use_self
Attempting to make the code slightly more readable by using Self
instead of repeating the type name (of the surrounding impl
block) over and over again.
This PR includes quite a few things:
- Autogenerate
GstVideo.VideoColorRange
, I don't see anything manual that's different; - Fixes
use_self
warnings inbase
,audio
,video
andgl
; - Replace
T::type_data
withSelf::type_data
infor T
blocks, mainly to silence a bunch of warnings while fixing the rest. Not sure if we want this; - Update
gir
to shorten the names inauto
toSelf
too: https://github.com/gtk-rs/gir/pull/1121; - Temporary commit to allow
use_self
on theauto
module. This made it easier to go over manual warnings, but we might as well leave it if we're serious about combatinguse_self
. It is a major hassle to fix every offender ingir
, like turning function arguments and return types intoSelf
. (It needs to be disabled or fixed insys
crates as well, where self-referential pointers are used in structs).
In the end this effort is futile if we can't enable clippy::use_self
in the CI... And we really can't unless someone performs a massive pass on the rest of the code. For the gstreamer
crate alone:
- nightly:
warning: 413 warnings emitted
- stable:
warning: 477 warnings emitted
Unfortunately stable has some false-positives when lifetime and templated Self
-types are involved, but nightly misses out on the valid suggestions there too (ie. it told me to replace Result<xxx>
with Self
, but not the Ok(xxx)
further down in the code). It's inconsistent and you have to run both + doublecheck every suggestion.