Fix various new clippy warnings

This commit is contained in:
Sebastian Dröge 2022-11-01 11:10:57 +02:00
parent 951f000622
commit 01e24d2018
22 changed files with 77 additions and 81 deletions

View file

@ -69,7 +69,7 @@ mod cairo_compositor {
.build()]
});
&*PROPERTIES
&PROPERTIES
}
// Called by the application whenever the value of a property should be changed.

View file

@ -21,7 +21,7 @@ impl ExampleCustomEvent {
#[allow(clippy::new_ret_no_self)]
pub fn new(send_eos: bool) -> gst::Event {
let s = gst::Structure::builder(Self::EVENT_NAME)
.field("send_eos", &send_eos)
.field("send_eos", send_eos)
.build();
gst::event::CustomDownstream::new(s)
}

View file

@ -178,7 +178,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Update the text layout. This function is only updating pango's internal state.
// So e.g. that after a 90 degree rotation it knows that what was previously going
// to end up as a 200x100 rectangle would now be 100x200.
pangocairo::functions::update_layout(&cr, &**layout);
pangocairo::functions::update_layout(&cr, layout);
let (width, _height) = layout.size();
// Using width and height of the text, we can properly possition it within
// our canvas.
@ -188,7 +188,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
);
// After telling the layout object where to draw itself, we actually tell
// it to draw itself into our cairo context.
pangocairo::functions::show_layout(&cr, &**layout);
pangocairo::functions::show_layout(&cr, layout);
// Here we go one step up in our stack of transformations, removing any
// changes we did to them since the last call to cr.save();

View file

@ -162,7 +162,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
// Update the text layout. This function is only updating pango's internal state.
// So e.g. that after a 90 degree rotation it knows that what was previously going
// to end up as a 200x100 rectangle would now be 100x200.
pangocairo::functions::update_layout(&cr, &**layout);
pangocairo::functions::update_layout(&cr, layout);
let (width, _height) = layout.size();
// Using width and height of the text, we can properly possition it within
// our canvas.
@ -172,7 +172,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
);
// After telling the layout object where to draw itself, we actually tell
// it to draw itself into our cairo context.
pangocairo::functions::show_layout(&cr, &**layout);
pangocairo::functions::show_layout(&cr, layout);
// Here we go one step up in our stack of transformations, removing any
// changes we did to them since the last call to cr.save();

View file

@ -74,7 +74,7 @@ impl AudioConverterConfig {
}
pub fn set_dither_method(&mut self, v: crate::AudioDitherMethod) {
self.0.set("GstAudioConverter.dither-method", &v);
self.0.set("GstAudioConverter.dither-method", v);
}
#[doc(alias = "get_dither_method")]
@ -86,7 +86,7 @@ impl AudioConverterConfig {
}
pub fn set_noise_shaping_method(&mut self, v: crate::AudioNoiseShapingMethod) {
self.0.set("GstAudioConverter.noise-shaping-method", &v);
self.0.set("GstAudioConverter.noise-shaping-method", v);
}
#[doc(alias = "get_noise_shaping_method")]
@ -98,7 +98,7 @@ impl AudioConverterConfig {
}
pub fn set_quantization(&mut self, v: u32) {
self.0.set("GstAudioConverter.quantization", &v);
self.0.set("GstAudioConverter.quantization", v);
}
#[doc(alias = "get_quantization")]
@ -110,7 +110,7 @@ impl AudioConverterConfig {
}
pub fn set_resampler_method(&mut self, v: crate::AudioResamplerMethod) {
self.0.set("GstAudioConverter.resampler-method", &v);
self.0.set("GstAudioConverter.resampler-method", v);
}
#[doc(alias = "get_resampler_method")]
@ -128,7 +128,7 @@ impl AudioConverterConfig {
assert_eq!(val.len(), length);
gst::Array::from_values(val.iter().map(|val| val.to_send_value())).to_send_value()
}));
self.0.set("GstAudioConverter.mix-matrix", &array);
self.0.set("GstAudioConverter.mix-matrix", array);
}
#[doc(alias = "get_mix_matrix")]
@ -157,7 +157,7 @@ impl AudioConverterConfig {
#[cfg(any(feature = "v1_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_22")))]
pub fn set_dither_threshold(&mut self, v: u32) {
self.0.set("GstAudioConverter.dither-threshold", &v);
self.0.set("GstAudioConverter.dither-threshold", v);
}
#[cfg(any(feature = "v1_22", feature = "dox"))]

View file

@ -400,7 +400,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {
@ -821,7 +821,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {

View file

@ -156,7 +156,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {
@ -282,7 +282,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {

View file

@ -820,7 +820,7 @@ impl<'a> ops::Deref for Ref<'a> {
type Target = Harness;
fn deref(&self) -> &Harness {
&*self.0
&self.0
}
}
@ -831,13 +831,13 @@ impl<'a> ops::Deref for RefMut<'a> {
type Target = Harness;
fn deref(&self) -> &Harness {
&*self.0
&self.0
}
}
impl<'a> ops::DerefMut for RefMut<'a> {
fn deref_mut(&mut self) -> &mut Harness {
&mut *self.0
&mut self.0
}
}

View file

@ -74,7 +74,7 @@ impl PlayConfig {
assert_initialized_main_thread!();
// FIXME: Work-around for
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
self.set("accurate-seek", &accurate);
self.set("accurate-seek", accurate);
}
#[doc(alias = "gst_play_config_set_user_agent")]

View file

@ -78,7 +78,7 @@ impl PlayerConfig {
assert_initialized_main_thread!();
// FIXME: Work-around for
// http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=cc58bd6ae071dec4ea7b4be626034accd0372755
self.set("accurate-seek", &accurate);
self.set("accurate-seek", accurate);
}
#[doc(alias = "gst_player_config_set_user_agent")]

View file

@ -172,7 +172,7 @@ unsafe extern "C" fn video_aggregator_pad_prepare_frame<T: VideoAggregatorPadImp
let imp = instance.imp();
let aggregator: Borrowed<VideoAggregator> = from_glib_borrow(aggregator);
let token = AggregateFramesToken(&*aggregator);
let token = AggregateFramesToken(&aggregator);
match imp.prepare_frame(&aggregator, &token, &from_glib_borrow(buffer)) {
Some(frame) => {
@ -195,7 +195,7 @@ unsafe extern "C" fn video_aggregator_pad_clean_frame<T: VideoAggregatorPadImpl>
let imp = instance.imp();
let aggregator: Borrowed<VideoAggregator> = from_glib_borrow(aggregator);
let token = AggregateFramesToken(&*aggregator);
let token = AggregateFramesToken(&aggregator);
let frame = if (*prepared_frame).buffer.is_null() {
None

View file

@ -180,7 +180,7 @@ impl VideoConverterConfig {
}
pub fn set_resampler_method(&mut self, v: crate::VideoResamplerMethod) {
self.0.set("GstVideoConverter.resampler-method", &v);
self.0.set("GstVideoConverter.resampler-method", v);
}
#[doc(alias = "get_resampler_method")]
@ -192,7 +192,7 @@ impl VideoConverterConfig {
}
pub fn set_chroma_resampler_method(&mut self, v: crate::VideoResamplerMethod) {
self.0.set("GstVideoConverter.chroma-resampler-method", &v);
self.0.set("GstVideoConverter.chroma-resampler-method", v);
}
#[doc(alias = "get_chroma_resampler_method")]
@ -204,7 +204,7 @@ impl VideoConverterConfig {
}
pub fn set_resampler_taps(&mut self, v: u32) {
self.0.set("GstVideoConverter.resampler-taps", &v);
self.0.set("GstVideoConverter.resampler-taps", v);
}
#[doc(alias = "get_resampler_taps")]
@ -216,7 +216,7 @@ impl VideoConverterConfig {
}
pub fn set_dither_method(&mut self, v: crate::VideoDitherMethod) {
self.0.set("GstVideoConverter.dither-method", &v);
self.0.set("GstVideoConverter.dither-method", v);
}
#[doc(alias = "get_dither_method")]
@ -228,7 +228,7 @@ impl VideoConverterConfig {
}
pub fn set_dither_quantization(&mut self, v: u32) {
self.0.set("GstVideoConverter.dither-quantization", &v);
self.0.set("GstVideoConverter.dither-quantization", v);
}
#[doc(alias = "get_dither_quantization")]
@ -240,7 +240,7 @@ impl VideoConverterConfig {
}
pub fn set_src_x(&mut self, v: i32) {
self.0.set("GstVideoConverter.src-x", &v);
self.0.set("GstVideoConverter.src-x", v);
}
#[doc(alias = "get_src_x")]
@ -252,7 +252,7 @@ impl VideoConverterConfig {
}
pub fn set_src_y(&mut self, v: i32) {
self.0.set("GstVideoConverter.src-y", &v);
self.0.set("GstVideoConverter.src-y", v);
}
#[doc(alias = "get_src_y")]
@ -265,7 +265,7 @@ impl VideoConverterConfig {
pub fn set_src_width(&mut self, v: Option<i32>) {
if let Some(v) = v {
self.0.set("GstVideoConverter.src-width", &v);
self.0.set("GstVideoConverter.src-width", v);
} else {
self.0.remove_field("GstVideoConverter.src-width");
}
@ -280,7 +280,7 @@ impl VideoConverterConfig {
pub fn set_src_height(&mut self, v: Option<i32>) {
if let Some(v) = v {
self.0.set("GstVideoConverter.src-height", &v);
self.0.set("GstVideoConverter.src-height", v);
} else {
self.0.remove_field("GstVideoConverter.src-height");
}
@ -294,7 +294,7 @@ impl VideoConverterConfig {
}
pub fn set_dest_x(&mut self, v: i32) {
self.0.set("GstVideoConverter.dest-x", &v);
self.0.set("GstVideoConverter.dest-x", v);
}
#[doc(alias = "get_dest_x")]
@ -306,7 +306,7 @@ impl VideoConverterConfig {
}
pub fn set_dest_y(&mut self, v: i32) {
self.0.set("GstVideoConverter.dest-y", &v);
self.0.set("GstVideoConverter.dest-y", v);
}
#[doc(alias = "get_dest_y")]
@ -319,7 +319,7 @@ impl VideoConverterConfig {
pub fn set_dest_width(&mut self, v: Option<i32>) {
if let Some(v) = v {
self.0.set("GstVideoConverter.dest-width", &v);
self.0.set("GstVideoConverter.dest-width", v);
} else {
self.0.remove_field("GstVideoConverter.dest-width");
}
@ -334,7 +334,7 @@ impl VideoConverterConfig {
pub fn set_dest_height(&mut self, v: Option<i32>) {
if let Some(v) = v {
self.0.set("GstVideoConverter.dest-height", &v);
self.0.set("GstVideoConverter.dest-height", v);
} else {
self.0.remove_field("GstVideoConverter.dest-height");
}
@ -348,7 +348,7 @@ impl VideoConverterConfig {
}
pub fn set_fill_border(&mut self, v: bool) {
self.0.set("GstVideoConverter.fill-border", &v);
self.0.set("GstVideoConverter.fill-border", v);
}
#[doc(alias = "get_fill_border")]
@ -360,7 +360,7 @@ impl VideoConverterConfig {
}
pub fn set_alpha_value(&mut self, v: f64) {
self.0.set("GstVideoConverter.alpha-value", &v);
self.0.set("GstVideoConverter.alpha-value", v);
}
#[doc(alias = "get_alpha_value")]
@ -372,7 +372,7 @@ impl VideoConverterConfig {
}
pub fn set_alpha_mode(&mut self, v: crate::VideoAlphaMode) {
self.0.set("GstVideoConverter.alpha-mode", &v);
self.0.set("GstVideoConverter.alpha-mode", v);
}
#[doc(alias = "get_alpha_mode")]
@ -384,7 +384,7 @@ impl VideoConverterConfig {
}
pub fn set_border_argb(&mut self, v: u32) {
self.0.set("GstVideoConverter.border-argb", &v);
self.0.set("GstVideoConverter.border-argb", v);
}
#[doc(alias = "get_border_argb")]
@ -396,7 +396,7 @@ impl VideoConverterConfig {
}
pub fn set_chroma_mode(&mut self, v: crate::VideoChromaMode) {
self.0.set("GstVideoConverter.chroma-mode", &v);
self.0.set("GstVideoConverter.chroma-mode", v);
}
#[doc(alias = "get_chroma_mode")]
@ -408,7 +408,7 @@ impl VideoConverterConfig {
}
pub fn set_matrix_mode(&mut self, v: crate::VideoMatrixMode) {
self.0.set("GstVideoConverter.matrix-mode", &v);
self.0.set("GstVideoConverter.matrix-mode", v);
}
#[doc(alias = "get_matrix_mode")]
@ -420,7 +420,7 @@ impl VideoConverterConfig {
}
pub fn set_gamma_mode(&mut self, v: crate::VideoGammaMode) {
self.0.set("GstVideoConverter.gamma-mode", &v);
self.0.set("GstVideoConverter.gamma-mode", v);
}
#[doc(alias = "get_gamma_mode")]
@ -432,7 +432,7 @@ impl VideoConverterConfig {
}
pub fn set_primaries_mode(&mut self, v: crate::VideoPrimariesMode) {
self.0.set("GstVideoConverter.primaries-mode", &v);
self.0.set("GstVideoConverter.primaries-mode", v);
}
#[doc(alias = "get_primaries_mode")]
@ -444,7 +444,7 @@ impl VideoConverterConfig {
}
pub fn set_threads(&mut self, v: u32) {
self.0.set("GstVideoConverter.threads", &v);
self.0.set("GstVideoConverter.threads", v);
}
#[doc(alias = "get_threads")]

View file

@ -1049,7 +1049,7 @@ mod tests {
("bool", &true),
("string", &"bla"),
("fraction", &Fraction::new(1, 2)),
("array", &Array::new(&[&1, &2])),
("array", &Array::new([1, 2])),
],
);
assert_eq!(
@ -1068,7 +1068,7 @@ mod tests {
("bool", &true),
("string", &"bla"),
("fraction", &Fraction::new(1, 2)),
("array", &Array::new(&[&1, &2])),
("array", &Array::new([1, 2])),
],
)
.as_ref()
@ -1098,7 +1098,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build();
assert_eq!(
caps.to_string(),
@ -1239,13 +1239,13 @@ mod tests {
Structure::builder("audio/x-raw")
.field(
"struct",
Structure::builder("nested").field("badger", &true).build(),
Structure::builder("nested").field("badger", true).build(),
)
.build(),
)
.structure(
Structure::builder("video/x-raw")
.field("width", &800u32)
.field("width", 800u32)
.build(),
)
.build();
@ -1255,8 +1255,8 @@ mod tests {
let caps = Caps::builder_full()
.structure(
Structure::builder("video/x-raw")
.field("array", &crate::Array::new(["a", "b", "c"]))
.field("list", &crate::List::new(["d", "e", "f"]))
.field("array", crate::Array::new(["a", "b", "c"]))
.field("list", crate::List::new(["d", "e", "f"]))
.build(),
)
.build();

View file

@ -237,7 +237,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build();
let pretty_config = ron::ser::PrettyConfig::new().new_line("".to_string());
@ -267,7 +267,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.features(&["foo:bar", "foo:baz"])
.build();
@ -301,7 +301,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.any_features()
.build();
@ -375,7 +375,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build()
.as_ref()
);
@ -406,7 +406,7 @@ mod tests {
.field("bool", true)
.field("string", str_none)
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build()
.as_ref()
);
@ -438,7 +438,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build()
.as_ref()
);
@ -465,7 +465,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build();
let caps_ser = ron::ser::to_string(&caps).unwrap();
let caps_de: Caps = ron::de::from_str(caps_ser.as_str()).unwrap();
@ -476,7 +476,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.features(&["foo:bar", "foo:baz"])
.build();
let caps_ser = ron::ser::to_string(&caps).unwrap();
@ -488,7 +488,7 @@ mod tests {
.field("bool", true)
.field("string", "bla")
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.any_features()
.build();
let caps_ser = ron::ser::to_string(&caps).unwrap();

View file

@ -2403,7 +2403,7 @@ mod tests {
{
let flush_start_evt = flush_start_evt.get_mut().unwrap();
let structure = flush_start_evt.structure_mut();
structure.set("test", &42u32);
structure.set("test", 42u32);
}
let structure = flush_start_evt.structure().unwrap();

View file

@ -1454,7 +1454,7 @@ where
}
};
let copied_size = new_buffer.copy_to_slice(0, &mut *map);
let copied_size = new_buffer.copy_to_slice(0, &mut map);
drop(map);
if let Err(copied_size) = copied_size {

View file

@ -1680,7 +1680,7 @@ mod tests {
let pos = p.result();
assert_eq!(pos.try_into(), Ok(ClockTime::NONE));
p.structure_mut().set("check_mut", &true);
p.structure_mut().set("check_mut", true);
// deref
assert!(!p.is_serialized());

View file

@ -1170,14 +1170,14 @@ mod tests {
let s = Structure::builder("test")
.field("f1", "abc")
.field("f2", &String::from("bcd"))
.field("f2", String::from("bcd"))
.field("f3", 123i32)
.field(
"f4",
Structure::builder("nested").field("badger", &true).build(),
Structure::builder("nested").field("badger", true).build(),
)
.field("f5", &crate::Array::new(["a", "b", "c"]))
.field("f6", &crate::List::new(["d", "e", "f"]))
.field("f5", crate::Array::new(["a", "b", "c"]))
.field("f6", crate::List::new(["d", "e", "f"]))
.build();
assert_eq!(format!("{:?}", s), "Structure(test { f1: (gchararray) \"abc\", f2: (gchararray) \"bcd\", f3: (gint) 123, f4: Structure(nested { badger: (gboolean) TRUE }), f5: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), f6: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })");

View file

@ -185,7 +185,7 @@ mod tests {
"date_time",
DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(),
)
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build();
let pretty_config = ron::ser::PrettyConfig::new().new_line("".to_string());
@ -241,7 +241,7 @@ mod tests {
DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap()
)
.field("fraction", Fraction::new(1, 2))
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build()
.as_ref()
);
@ -261,7 +261,7 @@ mod tests {
"date_time",
DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(),
)
.field("array", Array::new(&[&1, &2]))
.field("array", Array::new([1, 2]))
.build();
let s_ser = ron::ser::to_string(&s).unwrap();
let s_de: Structure = ron::de::from_str(s_ser.as_str()).unwrap();

View file

@ -1192,11 +1192,7 @@ mod tests {
.add_generic(&TAG_TITLE, "second title", TagMergeMode::Append)
.is_ok());
assert!(tags
.add_generic(
&TAG_DURATION,
&(ClockTime::SECOND * 120),
TagMergeMode::Append
)
.add_generic(&TAG_DURATION, ClockTime::SECOND * 120, TagMergeMode::Append)
.is_ok());
assert!(tags
.add_generic(&TAG_TITLE, "third title", TagMergeMode::Append)

View file

@ -308,7 +308,7 @@ mod tests {
let data = b"abcdefgh";
let data = &data[..];
let (probability, caps) = SliceTypeFind::type_find(&data);
let (probability, caps) = SliceTypeFind::type_find(data);
assert_eq!(caps, Some(Caps::builder("test/test").build()));
assert_eq!(probability, TypeFindProbability::Likely);

View file

@ -374,7 +374,7 @@ mod tests {
let value_13 = Fraction::new(1, 3);
let value_12 = Fraction::new(1, 2);
let array = Array::new(&[&value_13, &value_12]);
let array = Array::new([value_13, value_12]);
let res = ron::ser::to_string_pretty(&array, pretty_config.clone());
assert_eq!(
@ -394,7 +394,7 @@ mod tests {
// List
let value_12 = Fraction::new(1, 2);
let list = List::new(&[&value_12]);
let list = List::new([value_12]);
let res = ron::ser::to_string_pretty(&list, pretty_config);
assert_eq!(
@ -636,7 +636,7 @@ mod tests {
let value_13 = Fraction::new(1, 3);
let value_12 = Fraction::new(1, 2);
let array = Array::new(&[&value_13, &value_12]);
let array = Array::new([value_13, value_12]);
let array_ser = ron::ser::to_string(&array).unwrap();
let array_de: Array = ron::de::from_str(array_ser.as_str()).unwrap();
@ -657,7 +657,7 @@ mod tests {
// List
let value_12 = Fraction::new(1, 2);
let list = List::new(&[&value_12]);
let list = List::new([value_12]);
let list_ser = ron::ser::to_string(&list).unwrap();
let list_de: List = ron::de::from_str(list_ser.as_str()).unwrap();