Skip to content

Commit

Permalink
Merge pull request #653 from psychon/fix-clippy-warnings
Browse files Browse the repository at this point in the history
Fix new clippy warnings in beta
  • Loading branch information
mergify[bot] authored Jan 14, 2022
2 parents 14d7f4d + a77277d commit df1ff30
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 3 deletions.
1 change: 1 addition & 0 deletions generator/src/generator/namespace/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ fn generate_aux(
"/// Set the `{}` field of this structure.",
rust_case_name,
);
outln!(out, "#[must_use]");
outln!(
out,
"pub fn {}<I>(mut self, value: I) -> Self where I: Into<Option<{}>> {{",
Expand Down
2 changes: 1 addition & 1 deletion generator/src/generator/namespace/struct_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(super) fn emit_struct_type(
doc: Option<&xcbdefs::Doc>,
out: &mut Output,
) {
assert!(!(generate_serialize && !fields_need_serialize));
assert!(!generate_serialize || fields_need_serialize);
assert!(parse_size_constraint == StructSizeConstraint::None || generate_try_parse);

let deducible_fields = gather_deducible_fields(fields);
Expand Down
3 changes: 1 addition & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ impl std::fmt::Display for LibxcbLoadError {
"failed to get symbol \"{}\": {}",
symbol
.iter()
.map(|&c| std::ascii::escape_default(c))
.flatten()
.flat_map(|&c| std::ascii::escape_default(c))
.map(char::from)
.collect::<String>(),
e,
Expand Down
26 changes: 26 additions & 0 deletions src/protocol/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1814,66 +1814,79 @@ impl CreatePictureAux {
Default::default()
}
/// Set the `repeat` field of this structure.
#[must_use]
pub fn repeat<I>(mut self, value: I) -> Self where I: Into<Option<Repeat>> {
self.repeat = value.into();
self
}
/// Set the `alphamap` field of this structure.
#[must_use]
pub fn alphamap<I>(mut self, value: I) -> Self where I: Into<Option<Picture>> {
self.alphamap = value.into();
self
}
/// Set the `alphaxorigin` field of this structure.
#[must_use]
pub fn alphaxorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.alphaxorigin = value.into();
self
}
/// Set the `alphayorigin` field of this structure.
#[must_use]
pub fn alphayorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.alphayorigin = value.into();
self
}
/// Set the `clipxorigin` field of this structure.
#[must_use]
pub fn clipxorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.clipxorigin = value.into();
self
}
/// Set the `clipyorigin` field of this structure.
#[must_use]
pub fn clipyorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.clipyorigin = value.into();
self
}
/// Set the `clipmask` field of this structure.
#[must_use]
pub fn clipmask<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Pixmap>> {
self.clipmask = value.into();
self
}
/// Set the `graphicsexposure` field of this structure.
#[must_use]
pub fn graphicsexposure<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.graphicsexposure = value.into();
self
}
/// Set the `subwindowmode` field of this structure.
#[must_use]
pub fn subwindowmode<I>(mut self, value: I) -> Self where I: Into<Option<xproto::SubwindowMode>> {
self.subwindowmode = value.into();
self
}
/// Set the `polyedge` field of this structure.
#[must_use]
pub fn polyedge<I>(mut self, value: I) -> Self where I: Into<Option<PolyEdge>> {
self.polyedge = value.into();
self
}
/// Set the `polymode` field of this structure.
#[must_use]
pub fn polymode<I>(mut self, value: I) -> Self where I: Into<Option<PolyMode>> {
self.polymode = value.into();
self
}
/// Set the `dither` field of this structure.
#[must_use]
pub fn dither<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Atom>> {
self.dither = value.into();
self
}
/// Set the `componentalpha` field of this structure.
#[must_use]
pub fn componentalpha<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.componentalpha = value.into();
self
Expand Down Expand Up @@ -2216,66 +2229,79 @@ impl ChangePictureAux {
Default::default()
}
/// Set the `repeat` field of this structure.
#[must_use]
pub fn repeat<I>(mut self, value: I) -> Self where I: Into<Option<Repeat>> {
self.repeat = value.into();
self
}
/// Set the `alphamap` field of this structure.
#[must_use]
pub fn alphamap<I>(mut self, value: I) -> Self where I: Into<Option<Picture>> {
self.alphamap = value.into();
self
}
/// Set the `alphaxorigin` field of this structure.
#[must_use]
pub fn alphaxorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.alphaxorigin = value.into();
self
}
/// Set the `alphayorigin` field of this structure.
#[must_use]
pub fn alphayorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.alphayorigin = value.into();
self
}
/// Set the `clipxorigin` field of this structure.
#[must_use]
pub fn clipxorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.clipxorigin = value.into();
self
}
/// Set the `clipyorigin` field of this structure.
#[must_use]
pub fn clipyorigin<I>(mut self, value: I) -> Self where I: Into<Option<i32>> {
self.clipyorigin = value.into();
self
}
/// Set the `clipmask` field of this structure.
#[must_use]
pub fn clipmask<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Pixmap>> {
self.clipmask = value.into();
self
}
/// Set the `graphicsexposure` field of this structure.
#[must_use]
pub fn graphicsexposure<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.graphicsexposure = value.into();
self
}
/// Set the `subwindowmode` field of this structure.
#[must_use]
pub fn subwindowmode<I>(mut self, value: I) -> Self where I: Into<Option<xproto::SubwindowMode>> {
self.subwindowmode = value.into();
self
}
/// Set the `polyedge` field of this structure.
#[must_use]
pub fn polyedge<I>(mut self, value: I) -> Self where I: Into<Option<PolyEdge>> {
self.polyedge = value.into();
self
}
/// Set the `polymode` field of this structure.
#[must_use]
pub fn polymode<I>(mut self, value: I) -> Self where I: Into<Option<PolyMode>> {
self.polymode = value.into();
self
}
/// Set the `dither` field of this structure.
#[must_use]
pub fn dither<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Atom>> {
self.dither = value.into();
self
}
/// Set the `componentalpha` field of this structure.
#[must_use]
pub fn componentalpha<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.componentalpha = value.into();
self
Expand Down
15 changes: 15 additions & 0 deletions src/protocol/screensaver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,76 +748,91 @@ impl SetAttributesAux {
Default::default()
}
/// Set the `background_pixmap` field of this structure.
#[must_use]
pub fn background_pixmap<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Pixmap>> {
self.background_pixmap = value.into();
self
}
/// Set the `background_pixel` field of this structure.
#[must_use]
pub fn background_pixel<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.background_pixel = value.into();
self
}
/// Set the `border_pixmap` field of this structure.
#[must_use]
pub fn border_pixmap<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Pixmap>> {
self.border_pixmap = value.into();
self
}
/// Set the `border_pixel` field of this structure.
#[must_use]
pub fn border_pixel<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.border_pixel = value.into();
self
}
/// Set the `bit_gravity` field of this structure.
#[must_use]
pub fn bit_gravity<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Gravity>> {
self.bit_gravity = value.into();
self
}
/// Set the `win_gravity` field of this structure.
#[must_use]
pub fn win_gravity<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Gravity>> {
self.win_gravity = value.into();
self
}
/// Set the `backing_store` field of this structure.
#[must_use]
pub fn backing_store<I>(mut self, value: I) -> Self where I: Into<Option<xproto::BackingStore>> {
self.backing_store = value.into();
self
}
/// Set the `backing_planes` field of this structure.
#[must_use]
pub fn backing_planes<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.backing_planes = value.into();
self
}
/// Set the `backing_pixel` field of this structure.
#[must_use]
pub fn backing_pixel<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.backing_pixel = value.into();
self
}
/// Set the `override_redirect` field of this structure.
#[must_use]
pub fn override_redirect<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Bool32>> {
self.override_redirect = value.into();
self
}
/// Set the `save_under` field of this structure.
#[must_use]
pub fn save_under<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Bool32>> {
self.save_under = value.into();
self
}
/// Set the `event_mask` field of this structure.
#[must_use]
pub fn event_mask<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.event_mask = value.into();
self
}
/// Set the `do_not_propogate_mask` field of this structure.
#[must_use]
pub fn do_not_propogate_mask<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.do_not_propogate_mask = value.into();
self
}
/// Set the `colormap` field of this structure.
#[must_use]
pub fn colormap<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Colormap>> {
self.colormap = value.into();
self
}
/// Set the `cursor` field of this structure.
#[must_use]
pub fn cursor<I>(mut self, value: I) -> Self where I: Into<Option<xproto::Cursor>> {
self.cursor = value.into();
self
Expand Down
12 changes: 12 additions & 0 deletions src/protocol/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,31 +1230,37 @@ impl CreateAlarmAux {
Default::default()
}
/// Set the `counter` field of this structure.
#[must_use]
pub fn counter<I>(mut self, value: I) -> Self where I: Into<Option<Counter>> {
self.counter = value.into();
self
}
/// Set the `value_type` field of this structure.
#[must_use]
pub fn value_type<I>(mut self, value: I) -> Self where I: Into<Option<VALUETYPE>> {
self.value_type = value.into();
self
}
/// Set the `value` field of this structure.
#[must_use]
pub fn value<I>(mut self, value: I) -> Self where I: Into<Option<Int64>> {
self.value = value.into();
self
}
/// Set the `test_type` field of this structure.
#[must_use]
pub fn test_type<I>(mut self, value: I) -> Self where I: Into<Option<TESTTYPE>> {
self.test_type = value.into();
self
}
/// Set the `delta` field of this structure.
#[must_use]
pub fn delta<I>(mut self, value: I) -> Self where I: Into<Option<Int64>> {
self.delta = value.into();
self
}
/// Set the `events` field of this structure.
#[must_use]
pub fn events<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.events = value.into();
self
Expand Down Expand Up @@ -1470,31 +1476,37 @@ impl ChangeAlarmAux {
Default::default()
}
/// Set the `counter` field of this structure.
#[must_use]
pub fn counter<I>(mut self, value: I) -> Self where I: Into<Option<Counter>> {
self.counter = value.into();
self
}
/// Set the `value_type` field of this structure.
#[must_use]
pub fn value_type<I>(mut self, value: I) -> Self where I: Into<Option<VALUETYPE>> {
self.value_type = value.into();
self
}
/// Set the `value` field of this structure.
#[must_use]
pub fn value<I>(mut self, value: I) -> Self where I: Into<Option<Int64>> {
self.value = value.into();
self
}
/// Set the `test_type` field of this structure.
#[must_use]
pub fn test_type<I>(mut self, value: I) -> Self where I: Into<Option<TESTTYPE>> {
self.test_type = value.into();
self
}
/// Set the `delta` field of this structure.
#[must_use]
pub fn delta<I>(mut self, value: I) -> Self where I: Into<Option<Int64>> {
self.delta = value.into();
self
}
/// Set the `events` field of this structure.
#[must_use]
pub fn events<I>(mut self, value: I) -> Self where I: Into<Option<u32>> {
self.events = value.into();
self
Expand Down
Loading

0 comments on commit df1ff30

Please sign in to comment.