fix some Rust 1.78.0 clippy warnings

This commit is contained in:
Scott Lamb 2024-06-01 06:00:28 -07:00
parent 6c227ec0f5
commit c20c644747
5 changed files with 14 additions and 7 deletions

View File

@ -133,7 +133,7 @@ fn poll_impl(inner: &Inner, waker_i: &mut usize, cx: &mut Context<'_>) -> Poll<(
} else {
let existing_waker = &mut wakers[*waker_i];
if !new_waker.will_wake(existing_waker) {
*existing_waker = new_waker.clone();
existing_waker.clone_from(new_waker);
}
}
Poll::Pending

View File

@ -113,7 +113,7 @@ fn handle_bundled_ui() -> Result<(), BoxError> {
None => {
bare_path = path;
encoding = FileEncoding::Uncompressed;
if files.get(bare_path).is_some() {
if files.contains_key(bare_path) {
continue; // don't replace with suboptimal encoding.
}
}

View File

@ -181,14 +181,16 @@ fn press_edit(siv: &mut Cursive, db: &Arc<db::Database>, id: Option<i32>) {
);
}
let stream_change = &mut change.streams[i];
stream_change.config.mode = (if stream.record {
(if stream.record {
db::json::STREAM_MODE_RECORD
} else {
""
})
.to_owned();
.clone_into(&mut stream_change.config.mode);
stream_change.config.url = parse_stream_url(type_, &stream.url)?;
stream_change.config.rtsp_transport = stream.rtsp_transport.to_owned();
stream
.rtsp_transport
.clone_into(&mut stream_change.config.rtsp_transport);
stream_change.sample_file_dir_id = stream.sample_file_dir_id;
stream_change.config.flush_if_sec = if stream.flush_if_sec.is_empty() {
0

View File

@ -157,7 +157,7 @@ fn parse_extra_data_inner(extradata: &[u8]) -> Result<VideoSampleEntryToInsert,
let mut ctx = h264_reader::Context::new();
for sps in avcc.sequence_parameter_sets() {
let sps = h264_reader::nal::RefNal::new(
&sps.map_err(|e| err!(InvalidArgument, msg("bad SPS: {e:?}")))?[..],
sps.map_err(|e| err!(InvalidArgument, msg("bad SPS: {e:?}")))?,
&[],
true,
);
@ -169,7 +169,7 @@ fn parse_extra_data_inner(extradata: &[u8]) -> Result<VideoSampleEntryToInsert,
}
for pps in avcc.picture_parameter_sets() {
let pps = h264_reader::nal::RefNal::new(
&pps.map_err(|e| err!(InvalidArgument, msg("bad PPS: {e:?}")))?[..],
pps.map_err(|e| err!(InvalidArgument, msg("bad PPS: {e:?}")))?,
&[],
true,
);

View File

@ -39,6 +39,11 @@ impl Service {
bail!(PermissionDenied, msg("view_video required"));
}
let (stream_id, camera_name);
// False positive: on Rust 1.78.0, clippy erroneously suggests calling `clone_from` on the
// uninitialized `camera_name`.
// Apparently fixed in rustc 1.80.0-nightly (ada5e2c7b 2024-05-31).
#[allow(clippy::assigning_clones)]
{
let db = self.db.lock();
let camera = db