Remove unnecessary mut everywhere

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1273>
This commit is contained in:
Sebastian Dröge 2023-07-11 10:09:35 +03:00
parent c2201480cf
commit bbd3d9ffe0
8 changed files with 16 additions and 16 deletions

View file

@ -132,7 +132,7 @@ impl AudioDecoderImpl for LewtonDec {
reorder_map: None, reorder_map: None,
}); });
let mut state = state_guard.as_mut().unwrap(); let state = state_guard.as_mut().unwrap();
let s = caps.structure(0).unwrap(); let s = caps.structure(0).unwrap();
if let Ok(Some(streamheaders)) = s.get_optional::<gst::ArrayRef>("streamheader") { if let Ok(Some(streamheaders)) = s.get_optional::<gst::ArrayRef>("streamheader") {

View file

@ -2943,7 +2943,7 @@ impl BaseWebRTCSink {
} }
let mut state = element.imp().state.lock().unwrap(); let mut state = element.imp().state.lock().unwrap();
if let Some(mut stream) = state.streams.get_mut(&name) { if let Some(stream) = state.streams.get_mut(&name) {
stream.out_caps = Some(payloader_caps.clone()); stream.out_caps = Some(payloader_caps.clone());
} }
@ -2997,7 +2997,7 @@ impl BaseWebRTCSink {
.unwrap() .unwrap()
.streams .streams
.iter_mut() .iter_mut()
.for_each(|(_, mut stream)| { .for_each(|(_, stream)| {
if stream.sink_pad.upcast_ref::<gst::Pad>() == pad { if stream.sink_pad.upcast_ref::<gst::Pad>() == pad {
stream.in_caps = Some(e.caps().to_owned()); stream.in_caps = Some(e.caps().to_owned());
} }

View file

@ -507,7 +507,7 @@ impl JsonGstParse {
fn loop_fn(&self) { fn loop_fn(&self) {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let State { ref mut pull, .. } = *state; let State { ref mut pull, .. } = *state;
let mut pull = pull.as_mut().unwrap(); let pull = pull.as_mut().unwrap();
let offset = pull.offset; let offset = pull.offset;
let scan_duration = pull.duration.is_none(); let scan_duration = pull.duration.is_none();
@ -519,7 +519,7 @@ impl JsonGstParse {
match self.scan_duration() { match self.scan_duration() {
Ok(pts) => { Ok(pts) => {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let mut pull = state.pull.as_mut().unwrap(); let pull = state.pull.as_mut().unwrap();
pull.duration = pts; pull.duration = pts;
} }
Err(err) => { Err(err) => {
@ -596,7 +596,7 @@ impl JsonGstParse {
self.handle_buffer(Some(buffer)) self.handle_buffer(Some(buffer))
} }
fn flush(&self, mut state: &mut State) { fn flush(&self, state: &mut State) {
state.reader.clear(); state.reader.clear();
if let Some(pull) = &mut state.pull { if let Some(pull) = &mut state.pull {
pull.offset = 0; pull.offset = 0;

View file

@ -1441,7 +1441,7 @@ impl FallbackSrc {
None => return, None => return,
}; };
let mut source = if fallback_source { let source = if fallback_source {
if let Some(ref mut source) = state.fallback_source { if let Some(ref mut source) = state.fallback_source {
source source
} else { } else {

View file

@ -205,7 +205,7 @@ impl State {
/* Collect cues, fixing up their duration based on the next cue */ /* Collect cues, fixing up their duration based on the next cue */
while let Some(lines) = self.pending.front() { while let Some(lines) = self.pending.front() {
if let Some(mut drained_line) = drained_lines.back_mut() { if let Some(drained_line) = drained_lines.back_mut() {
drained_line.duration = lines.pts - drained_line.pts; drained_line.duration = lines.pts - drained_line.pts;
} }
@ -219,7 +219,7 @@ impl State {
} }
/* cues that end a fragment must be clipped and cloned for the next fragment */ /* cues that end a fragment must be clipped and cloned for the next fragment */
if let Some(mut drained_line) = drained_lines.back_mut() { if let Some(drained_line) = drained_lines.back_mut() {
/* Clip to either the requested PTS, or segment stop if specified */ /* Clip to either the requested PTS, or segment stop if specified */
let end_pts = if running_time.is_none() { let end_pts = if running_time.is_none() {
self.last_pts.unwrap() self.last_pts.unwrap()

View file

@ -725,7 +725,7 @@ impl MccParse {
ref mut pull, ref mut pull,
.. ..
} = *state; } = *state;
let mut pull = pull.as_mut().unwrap(); let pull = pull.as_mut().unwrap();
let scan_tc_rate = tc_rate.is_none() && pull.duration.is_none(); let scan_tc_rate = tc_rate.is_none() && pull.duration.is_none();
let offset = pull.offset; let offset = pull.offset;
@ -763,12 +763,12 @@ impl MccParse {
match self.scan_duration() { match self.scan_duration() {
Ok(Some(tc)) => { Ok(Some(tc)) => {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let mut pull = state.pull.as_mut().unwrap(); let pull = state.pull.as_mut().unwrap();
pull.duration = Some(tc.time_since_daily_jam()); pull.duration = Some(tc.time_since_daily_jam());
} }
Ok(None) => { Ok(None) => {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let mut pull = state.pull.as_mut().unwrap(); let pull = state.pull.as_mut().unwrap();
pull.duration = Some(gst::ClockTime::ZERO); pull.duration = Some(gst::ClockTime::ZERO);
} }
Err(err) => { Err(err) => {

View file

@ -625,7 +625,7 @@ impl SccParse {
ref mut pull, ref mut pull,
.. ..
} = *state; } = *state;
let mut pull = pull.as_mut().unwrap(); let pull = pull.as_mut().unwrap();
let scan_duration = framerate.is_none() && pull.duration.is_none(); let scan_duration = framerate.is_none() && pull.duration.is_none();
let offset = pull.offset; let offset = pull.offset;
@ -662,12 +662,12 @@ impl SccParse {
match self.scan_duration() { match self.scan_duration() {
Ok(Some(tc)) => { Ok(Some(tc)) => {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let mut pull = state.pull.as_mut().unwrap(); let pull = state.pull.as_mut().unwrap();
pull.duration = Some(tc.time_since_daily_jam()); pull.duration = Some(tc.time_since_daily_jam());
} }
Ok(None) => { Ok(None) => {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let mut pull = state.pull.as_mut().unwrap(); let pull = state.pull.as_mut().unwrap();
pull.duration = Some(gst::ClockTime::ZERO); pull.duration = Some(gst::ClockTime::ZERO);
} }
Err(err) => { Err(err) => {

View file

@ -488,7 +488,7 @@ impl TtToCea608 {
fn generate( fn generate(
&self, &self,
mut state: &mut State, state: &mut State,
settings: &Settings, settings: &Settings,
pts: gst::ClockTime, pts: gst::ClockTime,
duration: gst::ClockTime, duration: gst::ClockTime,