Mark various enums that can signal errors as #[must_use]

See https://github.com/sdroege/gstreamer-rs/issues/44
This commit is contained in:
Sebastian Dröge 2017-11-05 19:16:50 +02:00
parent 3179806f01
commit e8638c1630
2 changed files with 24 additions and 4 deletions

View file

@ -18,11 +18,9 @@ generate = [
"Gst.ClockTimeDiff",
"Gst.Pipeline",
"Gst.State",
"Gst.StateChangeReturn",
"Gst.StateChange",
"Gst.SeekFlags",
"Gst.SeekType",
"Gst.FlowReturn",
"Gst.PadDirection",
"Gst.PadPresence",
"Gst.URIHandler",
@ -44,7 +42,6 @@ generate = [
"Gst.DeviceMonitor",
"Gst.StreamType",
"Gst.StreamFlags",
"Gst.PadLinkReturn",
"Gst.ProgressType",
"Gst.BusSyncReply",
"Gst.TagMergeMode",
@ -65,7 +62,6 @@ generate = [
"Gst.TocLoopType",
"Gst.TocSetter",
"Gst.ClockType",
"Gst.ClockReturn",
"Gst.ElementFlags",
"Gst.Rank",
"Gst.PadLinkCheck",
@ -705,3 +701,23 @@ status = "generate"
pattern = "parse.*full"
# wrong mutable for context parameter
ignore = true
[[object]]
name = "Gst.StateChangeReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.FlowReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.PadLinkReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.ClockReturn"
status = "generate"
must_use = true

View file

@ -191,6 +191,7 @@ impl SetValue for CapsIntersectMode {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum ClockReturn {
Ok,
Early,
@ -677,6 +678,7 @@ impl SetValue for EventType {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum FlowReturn {
CustomSuccess2,
CustomSuccess1,
@ -993,6 +995,7 @@ impl SetValue for PadDirection {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum PadLinkReturn {
Ok,
WrongHierarchy,
@ -1950,6 +1953,7 @@ impl SetValue for StateChange {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum StateChangeReturn {
Failure,
Success,