aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-07 23:28:45 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-07 23:28:45 +0100
commit9d1e1772c02032f70b6db584dddae8fd06b490d6 (patch)
tree9d97b4d3e1252c4b99f30a19f339700eaab44c45
parentd1b7691adb7c40bf21053d324fdac16c544cd536 (diff)
downloadjellything-9d1e1772c02032f70b6db584dddae8fd06b490d6.tar
jellything-9d1e1772c02032f70b6db584dddae8fd06b490d6.tar.bz2
jellything-9d1e1772c02032f70b6db584dddae8fd06b490d6.tar.zst
manual clippy
-rw-r--r--cache/src/lib.rs4
-rw-r--r--common/object/src/buffer.rs6
-rw-r--r--common/object/src/lib.rs10
-rw-r--r--common/object/src/tag.rs1
-rw-r--r--common/object/src/value.rs12
-rw-r--r--common/src/routes.rs2
-rw-r--r--database/src/kv/helpers.rs3
-rw-r--r--database/src/kv/index.rs1
-rw-r--r--database/src/kv/merge_iterator.rs2
-rw-r--r--database/src/lib.rs1
-rw-r--r--import/src/lib.rs25
-rw-r--r--import/src/plugins/acoustid.rs4
-rw-r--r--import/src/plugins/infojson.rs12
-rw-r--r--import/src/plugins/media_info.rs2
-rw-r--r--import/src/plugins/misc.rs30
-rw-r--r--import/src/plugins/mod.rs9
-rw-r--r--import/src/plugins/musicbrainz.rs2
-rw-r--r--import/src/plugins/tags.rs9
-rw-r--r--import/src/plugins/tmdb.rs18
-rw-r--r--import/src/plugins/trakt.rs18
-rw-r--r--import/src/plugins/vgmdb.rs8
-rw-r--r--import/src/plugins/wikidata.rs22
-rw-r--r--import/src/source_rank.rs15
-rw-r--r--remuxer/mp4/src/boxes.rs2
-rw-r--r--remuxer/src/codec_param/mod.rs2
-rw-r--r--remuxer/src/codec_param/vp9.rs3
-rw-r--r--remuxer/src/demuxers/flac.rs1
-rw-r--r--remuxer/src/lib.rs2
-rw-r--r--remuxer/src/muxers/mp4.rs4
-rw-r--r--server/src/routes/account/mod.rs5
-rw-r--r--server/src/routes/items.rs3
-rw-r--r--server/src/routes/stream.rs8
-rw-r--r--stream/src/dash.rs6
-rw-r--r--stream/src/fragment.rs11
-rw-r--r--stream/src/fragment_index.rs2
-rw-r--r--stream/src/hls.rs19
-rw-r--r--stream/src/lib.rs2
-rw-r--r--stream/src/stream_info.rs2
-rw-r--r--stream/types/src/path.rs8
-rw-r--r--transcoder/src/fragment.rs8
-rw-r--r--ui/client-style/build.rs2
-rw-r--r--ui/locale/src/lib.rs2
-rw-r--r--ui/src/components/node_card.rs28
-rw-r--r--ui/src/components/node_page.rs5
44 files changed, 169 insertions, 172 deletions
diff --git a/cache/src/lib.rs b/cache/src/lib.rs
index 4d6bbcf..0a7a2f1 100644
--- a/cache/src/lib.rs
+++ b/cache/src/lib.rs
@@ -65,7 +65,7 @@ impl Cache {
CACHE_GENERATION_LOCKS[bucket(key)].lock().ok()
};
- let out = match self.storage.read(&key)? {
+ let out = match self.storage.read(key)? {
Some(x) => x,
None => {
let value = generate()?;
@@ -115,7 +115,7 @@ impl Cache {
}
}
- let data = self.cache(&key, move || {
+ let data = self.cache(key, move || {
let object = generate()?;
Ok(serde_json::to_vec(&object)?)
})?;
diff --git a/common/object/src/buffer.rs b/common/object/src/buffer.rs
index 4d3af34..0de5d70 100644
--- a/common/object/src/buffer.rs
+++ b/common/object/src/buffer.rs
@@ -65,7 +65,7 @@ pub fn vec_to_ob(v: Vec<u32>) -> Box<Object> {
//? safe way to do this?
unsafe { std::mem::transmute(v.into_boxed_slice()) }
}
-pub const fn slice_to_ob<'a>(v: &'a [u32]) -> &'a Object {
+pub const fn slice_to_ob(v: &[u32]) -> &Object {
//? safe way to do this?
unsafe { std::mem::transmute(v) }
}
@@ -73,7 +73,7 @@ pub const fn slice_to_ob<'a>(v: &'a [u32]) -> &'a Object {
#[inline]
pub(super) fn pad_vec(temp: &mut Vec<u8>) -> u32 {
let mut pad = 0;
- while temp.len() % 4 != 0 {
+ while !temp.len().is_multiple_of(4) {
pad += 1;
temp.push(0);
}
@@ -96,7 +96,7 @@ pub fn slice_u8_to_u32<'a>(value: &'a [u8]) -> Cow<'a, [u32]> {
trace!("encountered unalined slice");
Cow::Owned(
value
- .into_iter()
+ .iter()
.copied()
.array_chunks()
.map(u32::from_ne_bytes)
diff --git a/common/object/src/lib.rs b/common/object/src/lib.rs
index 3790730..aadd306 100644
--- a/common/object/src/lib.rs
+++ b/common/object/src/lib.rs
@@ -33,7 +33,7 @@ impl ToOwned for Object {
}
}
-pub const EMPTY: &'static Object = slice_to_ob(&[0]);
+pub const EMPTY: &Object = slice_to_ob(&[0]);
impl Object {
#[inline]
@@ -92,7 +92,7 @@ impl Object {
let padding = start_raw & 0b11;
u32_len * 4 - padding
}
- fn get_aligned<'a>(&'a self, index: usize) -> Option<&'a [u32]> {
+ fn get_aligned(&self, index: usize) -> Option<&[u32]> {
let start_raw = self.offsets()[index];
let end_raw = self
.offsets()
@@ -106,7 +106,7 @@ impl Object {
Some(&self.values()[start as usize..end as usize])
}
- fn get_unaligned<'a>(&'a self, index: usize) -> Option<&'a [u8]> {
+ fn get_unaligned(&self, index: usize) -> Option<&[u8]> {
let start_raw = self.offsets()[index];
let end_raw = self
.offsets()
@@ -188,7 +188,7 @@ impl Object {
for val in values {
if new_vals.iter().all(|rhs| rhs.get(ident) != val.get(ident)) {
any_new = true;
- new_vals.push(&val);
+ new_vals.push(val);
}
}
if any_new {
@@ -286,7 +286,7 @@ impl Iterator for KeysIter<'_> {
type Item = Tag;
fn next(&mut self) -> Option<Self::Item> {
if self.index >= self.object.tags().len() {
- return None;
+ None
} else {
self.index += 1;
Some(Tag(self.object.tags()[self.index - 1]))
diff --git a/common/object/src/tag.rs b/common/object/src/tag.rs
index c09af27..c937d43 100644
--- a/common/object/src/tag.rs
+++ b/common/object/src/tag.rs
@@ -34,6 +34,7 @@ impl<T: ?Sized> Display for TypedTag<T> {
self.0.fmt(f)
}
}
+#[allow(clippy::non_canonical_clone_impl)]
impl<T: ?Sized> Clone for TypedTag<T> {
fn clone(&self) -> Self {
Self(self.0, PhantomData)
diff --git a/common/object/src/value.rs b/common/object/src/value.rs
index 0a1ceb9..ace10fe 100644
--- a/common/object/src/value.rs
+++ b/common/object/src/value.rs
@@ -73,10 +73,7 @@ pub enum ValueType {
impl ValueType {
#[inline]
pub const fn is_aligned(self) -> bool {
- match self {
- ValueType::Binary | ValueType::String => false,
- _ => true,
- }
+ !matches!(self, ValueType::Binary | ValueType::String)
}
pub fn from_num(n: u32) -> Self {
match n {
@@ -180,7 +177,7 @@ impl<'a> ValueSer<'a> for &'a str {
impl ValueSer<'_> for u32 {
const TYPE: ValueType = ValueType::UInt;
fn load_aligned(buf: &[u32]) -> Option<Self> {
- buf.get(0).copied().map(u32::from_be)
+ buf.first().copied().map(u32::from_be)
}
fn store_aligned(&self, buf: &mut Vec<u32>) {
buf.push(self.to_be());
@@ -192,7 +189,7 @@ impl ValueSer<'_> for u32 {
impl ValueSer<'_> for Tag {
const TYPE: ValueType = ValueType::Tag;
fn load_aligned(buf: &[u32]) -> Option<Self> {
- buf.get(0).copied().map(u32::from_be).map(Tag)
+ buf.first().copied().map(u32::from_be).map(Tag)
}
fn store_aligned(&self, buf: &mut Vec<u32>) {
buf.push(self.0.to_be());
@@ -203,6 +200,7 @@ impl ValueSer<'_> for Tag {
}
impl ValueSer<'_> for u64 {
const TYPE: ValueType = ValueType::UInt;
+ #[allow(clippy::get_first)]
fn load_aligned(buf: &[u32]) -> Option<Self> {
let hi = u32::from_be(*buf.get(0)?) as u64;
let lo = u32::from_be(*buf.get(1)?) as u64;
@@ -259,7 +257,7 @@ impl<'a> ValueSer<'a> for &'a Object {
buf.extend(&self.0);
}
fn size(&self) -> usize {
- self.0.len() * size_of::<u32>()
+ std::mem::size_of_val(&self.0)
}
}
impl<'a> ValueSer<'a> for &'a [u8] {
diff --git a/common/src/routes.rs b/common/src/routes.rs
index 96f36e2..2880eeb 100644
--- a/common/src/routes.rs
+++ b/common/src/routes.rs
@@ -52,7 +52,7 @@ pub fn u_admin_log(warn_only: bool) -> String {
format!("/admin/log?warn_only={warn_only}")
}
pub fn u_admin_import() -> String {
- format!("/admin/import")
+ "/admin/import".to_string()
}
pub fn u_admin_import_post(incremental: bool) -> String {
format!("/admin/import?incremental={incremental}")
diff --git a/database/src/kv/helpers.rs b/database/src/kv/helpers.rs
index dde067f..a98540f 100644
--- a/database/src/kv/helpers.rs
+++ b/database/src/kv/helpers.rs
@@ -13,7 +13,6 @@ pub fn write_counter(txn: &mut dyn jellykv::Transaction, t: &[u8], value: u64) -
pub fn read_counter(txn: &dyn jellykv::Transaction, t: &[u8], default: u64) -> Result<u64> {
Ok(txn
.get(t)?
- .map(|k| k.as_slice().try_into().map(RowNum::from_be_bytes).ok())
- .flatten()
+ .and_then(|k| k.as_slice().try_into().map(RowNum::from_be_bytes).ok())
.unwrap_or(default))
}
diff --git a/database/src/kv/index.rs b/database/src/kv/index.rs
index 5505079..0881cb7 100644
--- a/database/src/kv/index.rs
+++ b/database/src/kv/index.rs
@@ -82,6 +82,7 @@ pub fn read_count_index(txn: &dyn jellykv::Transaction, prefix: Vec<u8>) -> Resu
read_counter(txn, &prefix, 0)
}
+#[allow(clippy::type_complexity)]
pub fn iter_index<'a>(
txn: &'a dyn jellykv::Transaction,
prefix: Vec<u8>,
diff --git a/database/src/kv/merge_iterator.rs b/database/src/kv/merge_iterator.rs
index 8398ba4..e872823 100644
--- a/database/src/kv/merge_iterator.rs
+++ b/database/src/kv/merge_iterator.rs
@@ -7,10 +7,12 @@
use crate::RowNum;
use anyhow::Result;
+#[allow(clippy::type_complexity)]
pub struct MergeIterator<'a> {
iters: Vec<Box<dyn Iterator<Item = Result<(RowNum, Vec<u8>)>> + 'a>>,
}
impl<'a> MergeIterator<'a> {
+ #[allow(clippy::type_complexity)]
pub fn new(iters: Vec<Box<dyn Iterator<Item = Result<(RowNum, Vec<u8>)>> + 'a>>) -> Self {
Self { iters }
}
diff --git a/database/src/lib.rs b/database/src/lib.rs
index 62d6073..b315fa6 100644
--- a/database/src/lib.rs
+++ b/database/src/lib.rs
@@ -19,6 +19,7 @@ pub trait Database: Send + Sync {
fn transaction(&self, f: &mut dyn FnMut(&mut dyn Transaction) -> Result<()>) -> Result<()>;
}
+#[allow(clippy::type_complexity)]
pub trait Transaction {
fn insert(&mut self, entry: Box<Object>) -> Result<RowNum>;
fn remove(&mut self, row: RowNum) -> Result<()>;
diff --git a/import/src/lib.rs b/import/src/lib.rs
index 40a855a..97cd373 100644
--- a/import/src/lib.rs
+++ b/import/src/lib.rs
@@ -155,11 +155,11 @@ pub async fn import_wrap(ic: ImportConfig, incremental: bool) -> Result<()> {
}
fn import(ic: ImportConfig, rt: &Handle, incremental: bool) -> Result<()> {
- reporting::set_stage(format!("Initializing Plugins"), 0);
+ reporting::set_stage("Initializing Plugins".to_string(), 0);
let plugins = init_plugins(&ic.config.api);
- let ranks = SourceRanks::new();
+ let ranks = SourceRanks::default();
- reporting::set_stage(format!("Indexing files"), 0);
+ reporting::set_stage("Indexing files".to_string(), 0);
let files = Mutex::new(Vec::new());
import_traverse(
&ic.config.media_path,
@@ -173,10 +173,10 @@ fn import(ic: ImportConfig, rt: &Handle, incremental: bool) -> Result<()> {
let mut nodes = Mutex::new(HashSet::new());
- reporting::set_stage(format!("Importing files"), files.len());
+ reporting::set_stage("Importing files".to_string(), files.len());
files.into_par_iter().for_each(|(path, parent, iflags)| {
reporting::set_task(format!("unknown: {path:?}"));
- import_file(&ic, &rt, &ranks, &nodes, &plugins, &path, parent, iflags);
+ import_file(&ic, rt, &ranks, &nodes, &plugins, &path, parent, iflags);
reporting::inc_finished();
reporting::set_task("idle".to_owned());
});
@@ -192,7 +192,7 @@ fn import(ic: ImportConfig, rt: &Handle, incremental: bool) -> Result<()> {
swap(nodes.get_mut().unwrap(), &mut cur_nodes);
cur_nodes.into_par_iter().for_each(|node| {
reporting::set_task(format!("unknown: {node}"));
- process_node(&ic, &rt, &ranks, &plugins, &nodes, node);
+ process_node(&ic, rt, &ranks, &plugins, &nodes, node);
reporting::inc_finished();
reporting::set_task("idle".to_owned());
});
@@ -264,10 +264,8 @@ fn import_traverse(
if path.is_file()
&& let Some(parent) = parent
{
- if incremental {
- if !compare_mtime(ic, path)? {
- return Ok(());
- }
+ if incremental && !compare_mtime(ic, path)? {
+ return Ok(());
}
reporting::inc_total();
@@ -276,6 +274,7 @@ fn import_traverse(
Ok(())
}
+#[allow(clippy::too_many_arguments)]
fn import_file(
ic: &ImportConfig,
rt: &Handle,
@@ -499,8 +498,8 @@ fn get_node_slug(ic: &ImportConfig, path: &Path) -> Option<String> {
}
let filename = path.file_name()?.to_string_lossy();
let filestem = filename.split_once(".").unwrap_or((&filename, "")).0;
- if path.parent()? == &ic.config.media_path {
- Some(format!("{filestem}"))
+ if path.parent()? == ic.config.media_path {
+ Some(filestem.to_string())
} else {
let parent_filename = path.parent()?.file_name()?.to_string_lossy();
let parent_filestem = parent_filename
@@ -529,7 +528,7 @@ pub fn read_media_metadata(cache: &Cache, path: &Path) -> Result<Arc<matroska::S
// Replace data of useful attachments with cache key; delete data of all others
if let Some(attachments) = &mut attachments {
for att in &mut attachments.files {
- if let Some(fname) = is_useful_attachment(&att) {
+ if let Some(fname) = is_useful_attachment(att) {
let key = cache.store(
format!("media/attachment/{}-{fname}", HashKey(path)),
|| Ok(att.data.clone()),
diff --git a/import/src/plugins/acoustid.rs b/import/src/plugins/acoustid.rs
index caeeea5..07abb45 100644
--- a/import/src/plugins/acoustid.rs
+++ b/import/src/plugins/acoustid.rs
@@ -181,13 +181,13 @@ impl ImportPlugin for AcoustID {
let duration = (seg.info.duration.unwrap_or_default() * seg.info.timestamp_scale as f64)
/ 1_000_000_000.;
- if duration > 600. || duration < 10. {
+ if !(10. ..=600.).contains(&duration) {
return Ok(());
}
let fp = acoustid_fingerprint(&ct.ic.cache, path)?;
- let Some((atid, mbid)) = self.get_atid_mbid(&ct.ic.cache, &fp, &ct.rt)? else {
+ let Some((atid, mbid)) = self.get_atid_mbid(&ct.ic.cache, &fp, ct.rt)? else {
return Ok(());
};
diff --git a/import/src/plugins/infojson.rs b/import/src/plugins/infojson.rs
index dfa5279..ab50171 100644
--- a/import/src/plugins/infojson.rs
+++ b/import/src/plugins/infojson.rs
@@ -185,16 +185,16 @@ impl ImportPlugin for Infojson {
node = node.insert_s(ct.is, NO_TITLE, title);
if let Some(cid) = &data.channel_id {
node = node.update(NO_IDENTIFIERS, |ids| {
- ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL, &cid)
+ ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL, cid)
});
}
if let Some(uid) = &data.uploader_id {
node = node.update(NO_IDENTIFIERS, |ids| {
- ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL_HANDLE, &uid)
+ ids.insert_s(ct.is, IDENT_YOUTUBE_CHANNEL_HANDLE, uid)
})
}
if let Some(desc) = &data.description {
- node = node.insert_s(ct.is, NO_DESCRIPTION, &desc);
+ node = node.insert_s(ct.is, NO_DESCRIPTION, desc);
}
if let Some(followers) = data.channel_follower_count {
node = node.update(NO_RATINGS, |rat| {
@@ -248,15 +248,15 @@ impl ImportPlugin for Infojson {
&& title != &infojson.title
&& !node.has(NO_SUBTITLE.0)
{
- node = node.insert_s(ct.is, NO_SUBTITLE, &title);
+ node = node.insert_s(ct.is, NO_SUBTITLE, title);
}
if let Some(up) = &infojson.uploader
&& !node.has(NO_SUBTITLE.0)
{
- node = node.insert_s(ct.is, NO_SUBTITLE, &clean_uploader_name(&up));
+ node = node.insert_s(ct.is, NO_SUBTITLE, clean_uploader_name(up));
}
if let Some(desc) = &infojson.description {
- node = node.insert_s(ct.is, NO_DESCRIPTION, &desc);
+ node = node.insert_s(ct.is, NO_DESCRIPTION, desc);
}
if let Some(tag) = infojson.tags.clone() {
node = node.extend(NO_TAG, tag.iter().map(String::as_str));
diff --git a/import/src/plugins/media_info.rs b/import/src/plugins/media_info.rs
index 5daa3ba..780af45 100644
--- a/import/src/plugins/media_info.rs
+++ b/import/src/plugins/media_info.rs
@@ -92,7 +92,7 @@ impl ImportPlugin for MediaInfo {
if let Some(end) = cha.time_end {
chapter.push(CH_END, end as f64 * 1e-9);
}
- if let Some(display) = cha.displays.iter().next() {
+ if let Some(display) = cha.displays.first() {
chapter.push(CH_NAME, &display.string);
}
chapter.finish()
diff --git a/import/src/plugins/misc.rs b/import/src/plugins/misc.rs
index db9a8ab..283a1b6 100644
--- a/import/src/plugins/misc.rs
+++ b/import/src/plugins/misc.rs
@@ -183,22 +183,22 @@ impl ImportPlugin for EpisodeIndex {
}
fn media(&self, ct: &PluginContext, node: RowNum, path: &Path, _seg: &Segment) -> Result<()> {
let filename = path.file_name().unwrap().to_string_lossy();
- if let Some(cap) = RE_EPISODE_FILENAME.captures(&filename) {
- if let Some(episode) = cap.name("episode").map(|m| m.as_str()) {
- let season = cap.name("season").map(|m| m.as_str());
- let episode = episode.parse::<u64>().context("parse episode num")?;
- let season = season
- .unwrap_or("1")
- .parse::<u64>()
- .context("parse season num")?;
+ if let Some(cap) = RE_EPISODE_FILENAME.captures(&filename)
+ && let Some(episode) = cap.name("episode").map(|m| m.as_str())
+ {
+ let season = cap.name("season").map(|m| m.as_str());
+ let episode = episode.parse::<u64>().context("parse episode num")?;
+ let season = season
+ .unwrap_or("1")
+ .parse::<u64>()
+ .context("parse season num")?;
- ct.ic.update_node(node, |mut node| {
- node = node.insert_s(ct.is, NO_SEASON_INDEX, season);
- node = node.insert_s(ct.is, NO_INDEX, episode);
- node = node.insert_s(ct.is, NO_KIND, KIND_EPISODE);
- node
- })?;
- }
+ ct.ic.update_node(node, |mut node| {
+ node = node.insert_s(ct.is, NO_SEASON_INDEX, season);
+ node = node.insert_s(ct.is, NO_INDEX, episode);
+ node = node.insert_s(ct.is, NO_KIND, KIND_EPISODE);
+ node
+ })?;
}
Ok(())
}
diff --git a/import/src/plugins/mod.rs b/import/src/plugins/mod.rs
index 8fd1e67..cebe30e 100644
--- a/import/src/plugins/mod.rs
+++ b/import/src/plugins/mod.rs
@@ -61,6 +61,7 @@ pub trait ImportPlugin: Send + Sync {
}
}
+#[allow(clippy::vec_init_then_push)]
pub fn init_plugins(secrets: &ApiSecrets) -> Vec<Box<dyn ImportPlugin>> {
let mut plugins = Vec::<Box<dyn ImportPlugin>>::new();
@@ -73,16 +74,16 @@ pub fn init_plugins(secrets: &ApiSecrets) -> Vec<Box<dyn ImportPlugin>> {
plugins.push(Box::new(media_info::MediaInfo));
plugins.push(Box::new(infojson::Infojson));
if let Some(api_key) = &secrets.trakt {
- plugins.push(Box::new(trakt::Trakt::new(&api_key)));
+ plugins.push(Box::new(trakt::Trakt::new(api_key)));
}
if let Some(api_key) = &secrets.tmdb {
- plugins.push(Box::new(tmdb::Tmdb::new(&api_key))); // deps: trakt
+ plugins.push(Box::new(tmdb::Tmdb::new(api_key))); // deps: trakt
}
if let Some(api_key) = &secrets.omdb {
- plugins.push(Box::new(omdb::Omdb::new(&api_key))); // deps: trakt
+ plugins.push(Box::new(omdb::Omdb::new(api_key))); // deps: trakt
}
if let Some(api_key) = &secrets.acoustid {
- plugins.push(Box::new(acoustid::AcoustID::new(&api_key)));
+ plugins.push(Box::new(acoustid::AcoustID::new(api_key)));
}
plugins.push(Box::new(musicbrainz::MusicBrainz::new())); // deps: acoustid
plugins.push(Box::new(wikidata::Wikidata::new())); // deps: musicbrainz
diff --git a/import/src/plugins/musicbrainz.rs b/import/src/plugins/musicbrainz.rs
index deed38b..3b9a156 100644
--- a/import/src/plugins/musicbrainz.rs
+++ b/import/src/plugins/musicbrainz.rs
@@ -357,7 +357,6 @@ impl ImportPlugin for MusicBrainz {
impl MusicBrainz {
fn process_recording(&self, ct: &PluginContext, node_row: RowNum) -> Result<()> {
let data = ct.ic.get_node(node_row)?.unwrap();
- let data = data;
let Some(mbid) = data
.get(NO_IDENTIFIERS)
@@ -425,7 +424,6 @@ impl MusicBrainz {
fn process_artist(&self, ct: &PluginContext, node_row: RowNum) -> Result<()> {
let data = ct.ic.get_node(node_row)?.unwrap();
- let data = data;
let Some(mbid) = data
.get(NO_IDENTIFIERS)
diff --git a/import/src/plugins/tags.rs b/import/src/plugins/tags.rs
index 901bcc6..be3b262 100644
--- a/import/src/plugins/tags.rs
+++ b/import/src/plugins/tags.rs
@@ -44,9 +44,9 @@ impl ImportPlugin for Tags {
for (key, value) in &tags {
match key.as_str() {
"DESCRIPTION" | "SYNOPSIS" => {
- node = node.insert_s(ct.is, NO_DESCRIPTION, &value)
+ node = node.insert_s(ct.is, NO_DESCRIPTION, value)
}
- "COMMENT" => node = node.insert(NO_TAGLINE, &value),
+ "COMMENT" => node = node.insert(NO_TAGLINE, value),
"CONTENT_TYPE" => {
node = node.insert_s(
ct.is,
@@ -69,9 +69,8 @@ impl ImportPlugin for Tags {
"BARCODE" => IDENT_BARCODE,
_ => continue,
};
- node = node.update(NO_IDENTIFIERS, |idents| {
- idents.insert_s(ct.is, idty, &value)
- });
+ node = node
+ .update(NO_IDENTIFIERS, |idents| idents.insert_s(ct.is, idty, value));
}
}
}
diff --git a/import/src/plugins/tmdb.rs b/import/src/plugins/tmdb.rs
index 832e240..6e496d1 100644
--- a/import/src/plugins/tmdb.rs
+++ b/import/src/plugins/tmdb.rs
@@ -217,13 +217,13 @@ impl Tmdb {
let backdrop = details
.backdrop_path
.as_ref()
- .map(|path| self.image(&ct.ic.cache, &path, ct.rt))
+ .map(|path| self.image(&ct.ic.cache, path, ct.rt))
.transpose()
.context("backdrop image")?;
let poster = details
.poster_path
.as_ref()
- .map(|path| self.image(&ct.ic.cache, &path, ct.rt))
+ .map(|path| self.image(&ct.ic.cache, path, ct.rt))
.transpose()
.context("poster image")?;
@@ -236,21 +236,21 @@ impl Tmdb {
ct.ic.update_node(node, |mut node| {
if let Some(title) = &details.title {
- node = node.insert_s(ct.is, NO_TITLE, &title);
+ node = node.insert_s(ct.is, NO_TITLE, title);
}
if let Some(tagline) = &details.tagline {
- node = node.insert_s(ct.is, NO_TAGLINE, &tagline);
+ node = node.insert_s(ct.is, NO_TAGLINE, tagline);
}
node = node.insert_s(ct.is, NO_DESCRIPTION, &details.overview);
node = node.update(NO_RATINGS, |rat| {
rat.insert_s(ct.is, RTYP_TMDB, details.vote_average)
});
if let Some(poster) = &poster {
- node = node.update(NO_PICTURES, |rat| rat.insert_s(ct.is, PICT_COVER, &poster));
+ node = node.update(NO_PICTURES, |rat| rat.insert_s(ct.is, PICT_COVER, poster));
}
if let Some(backdrop) = &backdrop {
node = node.update(NO_PICTURES, |rat| {
- rat.insert_s(ct.is, PICT_BACKDROP, &backdrop)
+ rat.insert_s(ct.is, PICT_BACKDROP, backdrop)
});
}
if let Some(releasedate) = release_date {
@@ -262,7 +262,6 @@ impl Tmdb {
}
fn process_episode(&self, ct: &PluginContext, node: RowNum) -> Result<()> {
let data = ct.ic.get_node(node)?.unwrap();
- let data = data;
let (Some(episode), Some(season)) = (data.get(NO_INDEX), data.get(NO_SEASON_INDEX)) else {
return Ok(());
@@ -289,7 +288,7 @@ impl Tmdb {
let cover = details
.still_path
.as_ref()
- .map(|path| self.image(&ct.ic.cache, &path, ct.rt))
+ .map(|path| self.image(&ct.ic.cache, path, ct.rt))
.transpose()
.context("still image download")?;
let release_date = parse_release_date(&details.air_date)?;
@@ -304,7 +303,7 @@ impl Tmdb {
});
if let Some(cover) = &cover {
node = node.update(NO_PICTURES, |picts| {
- picts.insert_s(ct.is, PICT_COVER, &cover)
+ picts.insert_s(ct.is, PICT_COVER, cover)
});
}
node
@@ -313,7 +312,6 @@ impl Tmdb {
fn process_person(&self, ct: &PluginContext, node: RowNum) -> Result<()> {
let data = ct.ic.get_node(node)?.unwrap();
- let data = data;
let Some(id) = data
.get(NO_IDENTIFIERS)
diff --git a/import/src/plugins/trakt.rs b/import/src/plugins/trakt.rs
index 9c5786c..9fe25e6 100644
--- a/import/src/plugins/trakt.rs
+++ b/import/src/plugins/trakt.rs
@@ -473,29 +473,29 @@ impl Trakt {
node = node.insert_s(ct.is, NO_KIND, trakt_kind.as_node_kind());
node = node.insert_s(ct.is, NO_TITLE, &details.title);
if let Some(overview) = &details.overview {
- node = node.insert_s(ct.is, NO_DESCRIPTION, &overview);
+ node = node.insert_s(ct.is, NO_DESCRIPTION, overview);
}
if let Some(tagline) = &details.tagline {
- node = node.insert_s(ct.is, NO_TAGLINE, &tagline);
+ node = node.insert_s(ct.is, NO_TAGLINE, tagline);
}
if let Some(x) = details.ids.imdb.clone() {
node = node.update(NO_IDENTIFIERS, |idents| {
idents.insert_s(ct.is, IDENT_IMDB, &x)
});
}
- if let Some(x) = details.ids.tvdb.clone() {
+ if let Some(x) = details.ids.tvdb {
node = node.update(NO_IDENTIFIERS, |idents| {
idents.insert_s(ct.is, IDENT_TVDB, &x.to_string())
});
}
- if let Some(x) = details.ids.tmdb.clone() {
- if let Some(key) = match trakt_kind {
+ if let Some(x) = details.ids.tmdb
+ && let Some(key) = match trakt_kind {
TraktKind::Movie => Some(IDENT_TMDB_MOVIE),
TraktKind::Show => Some(IDENT_TMDB_SERIES),
_ => None,
- } {
- node = node.update(NO_IDENTIFIERS, |idents| idents.insert(key, &x.to_string()));
- };
+ }
+ {
+ node = node.update(NO_IDENTIFIERS, |idents| idents.insert(key, &x.to_string()));
}
if let Some(rating) = details.rating {
node = node.update(NO_RATINGS, |idents| idents.insert(RTYP_TRAKT, rating));
@@ -587,7 +587,7 @@ impl Trakt {
node = node.insert_s(ct.is, NO_INDEX, episode.number);
node = node.insert_s(ct.is, NO_TITLE, &episode.title);
if let Some(overview) = &episode.overview {
- node = node.insert_s(ct.is, NO_DESCRIPTION, &overview);
+ node = node.insert_s(ct.is, NO_DESCRIPTION, overview);
}
if let Some(r) = episode.rating {
node = node.update(NO_RATINGS, |rats| rats.insert_s(ct.is, RTYP_TRAKT, r));
diff --git a/import/src/plugins/vgmdb.rs b/import/src/plugins/vgmdb.rs
index f93e84c..5c02a42 100644
--- a/import/src/plugins/vgmdb.rs
+++ b/import/src/plugins/vgmdb.rs
@@ -99,10 +99,10 @@ impl Vgmdb {
rt: &Handle,
) -> Result<Option<String>> {
let html = self.scrape_artist_page(cache, id, rt)?;
- if let Some(cap) = RE_IMAGE_URL_FROM_HTML.captures(&str::from_utf8(&html).unwrap()) {
- if let Some(url) = cap.name("url").map(|m| m.as_str()) {
- return Ok(Some(url.to_string()));
- }
+ if let Some(cap) = RE_IMAGE_URL_FROM_HTML.captures(str::from_utf8(&html).unwrap())
+ && let Some(url) = cap.name("url").map(|m| m.as_str())
+ {
+ return Ok(Some(url.to_string()));
}
Ok(None)
}
diff --git a/import/src/plugins/wikidata.rs b/import/src/plugins/wikidata.rs
index 5b79592..3ef51f2 100644
--- a/import/src/plugins/wikidata.rs
+++ b/import/src/plugins/wikidata.rs
@@ -101,17 +101,17 @@ impl Wikidata {
pub fn query_image_path(&self, cache: &Cache, id: &str, rt: &Handle) -> Result<Option<String>> {
let response = self.query(cache, id, rt)?;
- if let Some(entity) = response.entities.get(id) {
- if let Some(images) = entity.claims.get(properties::IMAGE) {
- for image in images {
- if image.mainsnak.datatype != "commonsMedia" {
- bail!("image is of type {:?}", image.mainsnak.datatype);
- }
- if let Some(dv) = &image.mainsnak.datavalue {
- if let Value::String(filename) = &dv.value {
- return Ok(Some(filename.to_owned()));
- }
- }
+ if let Some(entity) = response.entities.get(id)
+ && let Some(images) = entity.claims.get(properties::IMAGE)
+ {
+ for image in images {
+ if image.mainsnak.datatype != "commonsMedia" {
+ bail!("image is of type {:?}", image.mainsnak.datatype);
+ }
+ if let Some(dv) = &image.mainsnak.datavalue
+ && let Value::String(filename) = &dv.value
+ {
+ return Ok(Some(filename.to_owned()));
}
}
}
diff --git a/import/src/source_rank.rs b/import/src/source_rank.rs
index 3058df4..2ce1661 100644
--- a/import/src/source_rank.rs
+++ b/import/src/source_rank.rs
@@ -37,19 +37,18 @@ impl ObjectImportSourceExt for Object {
let ms = self.get(NO_METASOURCE).unwrap_or(EMPTY);
let ms_key = TypedTag::<Tag>::new(key.0);
- if let Some(current_source) = ms.get(ms_key) {
- if !is.ranks.compare(key.0, current_source, is.tag) {
- return self.to_owned();
- }
+ if let Some(current_source) = ms.get(ms_key)
+ && !is.ranks.compare(key.0, current_source, is.tag)
+ {
+ return self.to_owned();
}
self.insert(key, value)
.update(NO_METASOURCE, |ms| ms.insert(ms_key, is.tag))
}
}
-
-impl SourceRanks {
- pub fn new() -> Self {
+impl Default for SourceRanks {
+ fn default() -> Self {
Self {
list: [
MSOURCE_EXPLICIT,
@@ -68,6 +67,8 @@ impl SourceRanks {
.to_vec(),
}
}
+}
+impl SourceRanks {
pub fn compare(&self, key: Tag, old: Tag, new: Tag) -> bool {
let _ = key;
diff --git a/remuxer/mp4/src/boxes.rs b/remuxer/mp4/src/boxes.rs
index 3a1b188..4d5d35c 100644
--- a/remuxer/mp4/src/boxes.rs
+++ b/remuxer/mp4/src/boxes.rs
@@ -196,7 +196,7 @@ impl WriteBox for MediaHeader {
buf.extend(
((self.language[0] as u16 & 0b11111 << 10)
| (self.language[1] as u16 & 0b11111 << 5)
- | (self.language[2] as u16 & 0b11111 << 0))
+ | (self.language[2] as u16 & 0b11111))
.to_be_bytes(),
);
buf.extend([0; 2]);
diff --git a/remuxer/src/codec_param/mod.rs b/remuxer/src/codec_param/mod.rs
index 3ddf224..4fdb181 100644
--- a/remuxer/src/codec_param/mod.rs
+++ b/remuxer/src/codec_param/mod.rs
@@ -15,7 +15,7 @@ pub fn codec_param(te: &TrackEntry) -> String {
let empty_cp = vec![];
let cp = te.codec_private.as_ref().unwrap_or(&empty_cp);
match te.codec_id.as_str() {
- "A_AAC" => format!("mp4a.40.2"), // TODO
+ "A_AAC" => "mp4a.40.2".to_string(),
"A_FLAC" => "flac".to_string(),
"A_OPUS" => "opus".to_string(),
"A_VORBIS" => "vorbis".to_string(),
diff --git a/remuxer/src/codec_param/vp9.rs b/remuxer/src/codec_param/vp9.rs
index b3ed04c..59c0331 100644
--- a/remuxer/src/codec_param/vp9.rs
+++ b/remuxer/src/codec_param/vp9.rs
@@ -30,6 +30,7 @@ struct VPLevelDef {
}
static LEVELS: &[VPLevelDef] = {
+ #[allow(clippy::too_many_arguments)]
const fn level(
a: VPLevel,
b: u64,
@@ -74,5 +75,5 @@ static LEVELS: &[VPLevelDef] = {
};
pub fn vp9_codec_param(_te: &TrackEntry) -> String {
- format!("vp09.00.50.08")
+ "vp09.00.50.08".to_string()
}
diff --git a/remuxer/src/demuxers/flac.rs b/remuxer/src/demuxers/flac.rs
index ecaf6c4..64661ab 100644
--- a/remuxer/src/demuxers/flac.rs
+++ b/remuxer/src/demuxers/flac.rs
@@ -65,6 +65,7 @@ impl StreamInfo {
}
impl FlacDemuxer {
+ #[allow(clippy::unnecessary_unwrap)] // lifetime problems
fn read_metadata(&mut self) -> Result<&Vec<MetadataBlock>> {
if self.metadata.is_some() {
return Ok(self.metadata.as_ref().unwrap());
diff --git a/remuxer/src/lib.rs b/remuxer/src/lib.rs
index b4f6600..6afe7cb 100644
--- a/remuxer/src/lib.rs
+++ b/remuxer/src/lib.rs
@@ -5,10 +5,10 @@
*/
#![feature(stmt_expr_attributes)]
+mod codec_param;
pub mod demuxers;
pub mod magic;
pub mod muxers;
-mod codec_param;
pub use codec_param::codec_param;
pub use winter_matroska as matroska;
diff --git a/remuxer/src/muxers/mp4.rs b/remuxer/src/muxers/mp4.rs
index acc1166..72bec3e 100644
--- a/remuxer/src/muxers/mp4.rs
+++ b/remuxer/src/muxers/mp4.rs
@@ -131,7 +131,7 @@ impl FragmentMuxer for MP4FragmentMuxer {
let start_pts = (segment.clusters[0].timestamp as i64
+ segment.clusters[0]
.simple_blocks
- .get(0)
+ .first()
.map(|b| b.timestamp_off)
.unwrap_or_else(|| segment.clusters[0].block_groups[0].block.timestamp_off)
as i64)
@@ -154,7 +154,7 @@ impl FragmentMuxer for MP4FragmentMuxer {
let pts_off = (ts - start_pts) - dts;
samples.push(TrackRunSample {
composition_time_offset: pts_off.try_into().expect("cts_offset overflow"),
- duration: dts_delta as u32,
+ duration: dts_delta,
flags: 0,
size: block.data.len() as u32,
});
diff --git a/server/src/routes/account/mod.rs b/server/src/routes/account/mod.rs
index e15df9e..1ca0ce1 100644
--- a/server/src/routes/account/mod.rs
+++ b/server/src/routes/account/mod.rs
@@ -58,6 +58,7 @@ pub struct LoginForm {
}
#[post("/account/login", data = "<form>")]
+#[allow(clippy::type_complexity)]
pub fn r_account_login_post(
ri: RequestInfo<'_>,
jar: &CookieJar,
@@ -83,7 +84,7 @@ pub fn r_account_login_post(
};
if need_pw_change {
if let Some(new_password) = &form.new_password {
- let password_hash = hash_password(&form.username, &new_password);
+ let password_hash = hash_password(&form.username, new_password);
ri.state.database.transaction(&mut |txn| {
let user_row = txn.query_single(Query {
filter: Filter::Match(Path(vec![USER_LOGIN.0]), form.username.clone().into()),
@@ -94,7 +95,7 @@ pub fn r_account_login_post(
user = user.remove(USER_PASSWORD_REQUIRE_CHANGE);
user = user.insert(USER_PASSWORD, &password_hash);
if let Some(name) = &form.display_name {
- user = user.insert(USER_NAME, &name);
+ user = user.insert(USER_NAME, name);
}
txn.update(ur, user)?;
}
diff --git a/server/src/routes/items.rs b/server/src/routes/items.rs
index 0f7386c..84869a1 100644
--- a/server/src/routes/items.rs
+++ b/server/src/routes/items.rs
@@ -39,7 +39,6 @@ pub fn r_items(ri: RequestInfo, cont: Option<&str>) -> MyResult<RawHtml<String>>
offset: None,
}),
continuation: cont_in.clone(),
- ..Default::default()
})?
.take(64)
.collect::<Result<Vec<_>, _>>()?;
@@ -59,7 +58,7 @@ pub fn r_items(ri: RequestInfo, cont: Option<&str>) -> MyResult<RawHtml<String>>
items: &items
.iter()
.map(|node| Nku {
- node: Cow::Borrowed(&node),
+ node: Cow::Borrowed(node),
userdata: Cow::Borrowed(EMPTY),
role: None,
})
diff --git a/server/src/routes/stream.rs b/server/src/routes/stream.rs
index f117070..9868d6a 100644
--- a/server/src/routes/stream.rs
+++ b/server/src/routes/stream.rs
@@ -95,10 +95,10 @@ pub async fn r_stream(
let mut sources = BTreeSet::new();
for track in node.iter(NO_TRACK) {
- if let Some(s) = track.get(TR_SOURCE) {
- if let Some(path) = s.get(TRSOURCE_LOCAL_PATH) {
- sources.insert(path.into());
- }
+ if let Some(s) = track.get(TR_SOURCE)
+ && let Some(path) = s.get(TRSOURCE_LOCAL_PATH)
+ {
+ sources.insert(path.into());
}
}
let media = Arc::new(SMediaInfo {
diff --git a/stream/src/dash.rs b/stream/src/dash.rs
index 9e66a0f..f9fb128 100644
--- a/stream/src/dash.rs
+++ b/stream/src/dash.rs
@@ -14,7 +14,7 @@ use std::{
};
pub fn dash(sinfo: &SMediaInfo) -> Result<Box<dyn Read + Send + Sync>> {
- let (_iinfo, info) = stream_info(&sinfo)?;
+ let (_iinfo, info) = stream_info(sinfo)?;
let mut out = String::new();
@@ -37,7 +37,7 @@ pub fn dash(sinfo: &SMediaInfo) -> Result<Box<dyn Read + Send + Sync>> {
writeln!(out, "<ServiceDescription id=\"0\"></ServiceDescription>")?;
writeln!(out, r#"<Period id="0" start="PT0.0S">"#)?;
for (as_id, track) in info.tracks.iter().enumerate() {
- let frags = fragment_index(&sinfo, as_id)?;
+ let frags = fragment_index(sinfo, as_id)?;
match track.kind {
TrackKind::Video => {
let max_width = track
@@ -170,7 +170,7 @@ fn write_segment_template(
container.file_ext(TrackKind::Video),
container.file_ext(TrackKind::Video)
)?;
- writeln!(out, "{}", Timeline(&frags))?;
+ writeln!(out, "{}", Timeline(frags))?;
writeln!(out, "</SegmentTemplate>")?;
Ok(())
}
diff --git a/stream/src/fragment.rs b/stream/src/fragment.rs
index 0ccf37d..1774e0a 100644
--- a/stream/src/fragment.rs
+++ b/stream/src/fragment.rs
@@ -28,7 +28,7 @@ pub fn fragment_init(
track_num: TrackNum,
format_num: FormatNum,
) -> Result<Segment> {
- let (iinfo, info) = stream_info(&sinfo)?;
+ let (iinfo, info) = stream_info(sinfo)?;
let (file_index, file_track_num) = *iinfo
.track_to_file
@@ -101,7 +101,7 @@ pub fn fragment_remux(
index: IndexNum,
next_kf: bool,
) -> Result<Segment> {
- let cue_stat = generate_cues(&sinfo.cache, &media_path)?;
+ let cue_stat = generate_cues(&sinfo.cache, media_path)?;
let start_cue = cue_stat
.cues
.get(index)
@@ -109,7 +109,7 @@ pub fn fragment_remux(
let cluster_offset = start_cue.position;
let (mut cluster, next_cluster) = {
- let media_file = File::open(&media_path)?;
+ let media_file = File::open(media_path)?;
let mut media = create_demuxer_autodetect(Box::new(media_file))?
.ok_or(anyhow!("media container unknown"))?;
media.seek_cluster(Some(cluster_offset))?;
@@ -141,6 +141,7 @@ pub fn fragment_remux(
})
}
+#[allow(clippy::too_many_arguments)]
pub fn fragment_transcode_full(
sinfo: &SMediaInfo,
track: &StreamTrackInfo,
@@ -168,8 +169,8 @@ pub fn fragment_transcode_full(
index,
end_pts,
|| {
- let init = fragment_init(&sinfo, track_num, input_format_num)?;
- let seg = fragment_remux(&sinfo, &media_path, file_track_num, index, true)?;
+ let init = fragment_init(sinfo, track_num, input_format_num)?;
+ let seg = fragment_remux(sinfo, media_path, file_track_num, index, true)?;
Ok(Segment {
tracks: init.tracks,
info: init.info,
diff --git a/stream/src/fragment_index.rs b/stream/src/fragment_index.rs
index e2adf41..7b8ce01 100644
--- a/stream/src/fragment_index.rs
+++ b/stream/src/fragment_index.rs
@@ -13,7 +13,7 @@ use std::{
};
pub fn fragment_index(sinfo: &SMediaInfo, track: TrackNum) -> Result<Vec<Range<f64>>> {
- let (iinfo, info) = stream_info(&sinfo)?;
+ let (iinfo, info) = stream_info(sinfo)?;
let (file_index, _) = *iinfo
.track_to_file
.get(track)
diff --git a/stream/src/hls.rs b/stream/src/hls.rs
index 759b196..cbaf69e 100644
--- a/stream/src/hls.rs
+++ b/stream/src/hls.rs
@@ -14,7 +14,7 @@ use std::{
};
pub fn hls_multivariant_stream(info: &SMediaInfo) -> Result<Box<dyn Read + Send + Sync>> {
- let (_iinfo, info) = stream_info(&info)?;
+ let (_iinfo, info) = stream_info(info)?;
let mut out = String::new();
writeln!(out, "#EXTM3U")?;
@@ -22,14 +22,11 @@ pub fn hls_multivariant_stream(info: &SMediaInfo) -> Result<Box<dyn Read + Send
// writeln!(out, "#EXT-X-INDEPENDENT-SEGMENTS")?;
for (i, t) in info.tracks.iter().enumerate() {
for (j, f) in t.formats.iter().enumerate() {
- let uri = format!(
- "{}",
- StreamSpec::HlsVariant {
- track: i,
- format: j
- }
- .to_path()
- );
+ let uri = StreamSpec::HlsVariant {
+ track: i,
+ format: j,
+ }
+ .to_path();
let r#type = match t.kind {
TrackKind::Video => "VIDEO",
TrackKind::Audio => "AUDIO",
@@ -52,8 +49,8 @@ pub fn hls_variant_stream(
track: TrackNum,
_format: FormatNum,
) -> Result<Box<dyn Read + Send + Sync>> {
- let frags = fragment_index(&info, track)?;
- let (_, info) = stream_info(&info)?;
+ let frags = fragment_index(info, track)?;
+ let (_, info) = stream_info(info)?;
let mut out = String::new();
writeln!(out, "#EXTM3U")?;
diff --git a/stream/src/lib.rs b/stream/src/lib.rs
index 6dbc646..8827aeb 100644
--- a/stream/src/lib.rs
+++ b/stream/src/lib.rs
@@ -60,7 +60,7 @@ pub fn stream_head(spec: &StreamSpec) -> StreamHead {
let range_supported = matches!(spec, Remux { .. } | Original { .. });
let content_type = match spec {
Original { .. } => "video/x-matroska",
- HlsMultiVariant { .. } => "application/vnd.apple.mpegurl",
+ HlsMultiVariant => "application/vnd.apple.mpegurl",
HlsVariant { .. } => "application/vnd.apple.mpegurl",
Info => "application/jellything-stream-info+json",
Dash => "application/dash+xml",
diff --git a/stream/src/stream_info.rs b/stream/src/stream_info.rs
index c1f09ce..0d4350f 100644
--- a/stream/src/stream_info.rs
+++ b/stream/src/stream_info.rs
@@ -191,7 +191,7 @@ fn containers_by_codec(codec: &str) -> Vec<StreamContainer> {
}
pub(crate) fn write_stream_info(info: &SMediaInfo) -> Result<Box<dyn Read + Send + Sync>> {
- let (_, info) = stream_info(&info)?;
+ let (_, info) = stream_info(info)?;
Ok(Box::new(Cursor::new(serde_json::to_vec(&info)?)))
}
diff --git a/stream/types/src/path.rs b/stream/types/src/path.rs
index 4a91457..226d6e8 100644
--- a/stream/types/src/path.rs
+++ b/stream/types/src/path.rs
@@ -9,9 +9,9 @@ use crate::{FormatNum, IndexNum, StreamContainer, StreamSpec, TrackKind, TrackNu
impl StreamSpec {
pub fn to_path(&self) -> String {
match self {
- StreamSpec::HlsMultiVariant => format!("stream.m3u8"),
- StreamSpec::Dash => format!("stream.mpd"),
- StreamSpec::Info => format!("formats.json"),
+ StreamSpec::HlsMultiVariant => "stream.m3u8".to_string(),
+ StreamSpec::Dash => "stream.mpd".to_string(),
+ StreamSpec::Info => "formats.json".to_string(),
StreamSpec::HlsVariant { track, format } => format!("{track}/{format}/variant.m3u8"),
StreamSpec::FragmentIndex { track } => format!("{track}/fragindex.json"),
StreamSpec::FragmentInit {
@@ -35,7 +35,7 @@ impl StreamSpec {
}
}
pub fn from_path(segments: &[&str]) -> Result<Self, &'static str> {
- let mut segs = segments.into_iter();
+ let mut segs = segments.iter();
match *segs.next().ok_or("no path")? {
"stream.mpd" => Ok(Self::Dash),
"stream.m3u8" => Ok(Self::HlsMultiVariant),
diff --git a/transcoder/src/fragment.rs b/transcoder/src/fragment.rs
index c34e8ee..2ff36a7 100644
--- a/transcoder/src/fragment.rs
+++ b/transcoder/src/fragment.rs
@@ -55,6 +55,7 @@ pub fn transcode_init(
})
}
+#[allow(clippy::too_many_arguments)]
pub fn transcode(
cache: &Cache,
config: &Config,
@@ -66,7 +67,7 @@ pub fn transcode(
end_pts: u64,
segment: impl FnOnce() -> Result<Segment>,
) -> Result<Segment> {
- let command = transcode_command(kind, &input_format, output_format, false, config).unwrap();
+ let command = transcode_command(kind, input_format, output_format, false, config).unwrap();
let output = cache.cache(
&format!(
@@ -115,10 +116,7 @@ pub fn transcode(
}
//? Remove extra kf hack
- if clusters
- .last()
- .map_or(false, |c| c.simple_blocks.len() == 1)
- {
+ if clusters.last().is_some_and(|c| c.simple_blocks.len() == 1) {
clusters.pop();
}
diff --git a/ui/client-style/build.rs b/ui/client-style/build.rs
index 9e39aec..b0d10a3 100644
--- a/ui/client-style/build.rs
+++ b/ui/client-style/build.rs
@@ -16,7 +16,7 @@ fn main() {
println!("cargo:rerun-if-changed={}", file.to_str().unwrap());
out += &read_to_string(file).unwrap();
}
- let outpath: PathBuf = std::env::var("OUT_DIR").unwrap().try_into().unwrap();
+ let outpath: PathBuf = std::env::var("OUT_DIR").unwrap().into();
File::create(outpath.join("bundle.css"))
.unwrap()
.write_all(out.as_bytes())
diff --git a/ui/locale/src/lib.rs b/ui/locale/src/lib.rs
index d50d766..49e570b 100644
--- a/ui/locale/src/lib.rs
+++ b/ui/locale/src/lib.rs
@@ -33,7 +33,7 @@ pub static LANG_TABLES: LazyLock<HashMap<&'static str, HashMap<&'static str, &'s
langs
});
-fn parse_ini<'a>(source: &'a str) -> HashMap<&'a str, &'a str> {
+fn parse_ini(source: &str) -> HashMap<&str, &str> {
source
.lines()
.filter_map(|line| {
diff --git a/ui/src/components/node_card.rs b/ui/src/components/node_card.rs
index 36bd3e2..3aae631 100644
--- a/ui/src/components/node_card.rs
+++ b/ui/src/components/node_card.rs
@@ -18,20 +18,20 @@ markup::define! {
NodeCard<'a>(ri: &'a RenderInfo<'a>, nku: &'a Nku<'a>) {
@let node = &nku.node;
@let slug = node.get(NO_SLUG).unwrap_or_default();
- div[class=&format!("card {}", aspect_class(&node))] {
+ div[class=&format!("card {}", aspect_class(node))] {
.poster {
- a[href=u_node_slug(&slug)] {
- img[src=cover_image(&node, 512), loading="lazy"];
+ a[href=u_node_slug(slug)] {
+ img[src=cover_image(node, 512), loading="lazy"];
}
.overlay {
@if node.has(NO_TRACK.0) {
- a.play.icon[href=u_node_slug_player(&slug)] { "play_arrow" }
+ a.play.icon[href=u_node_slug_player(slug)] { "play_arrow" }
}
@Props { ri, nku, full: false }
}
}
div.title {
- a[href=u_node_slug(&slug)] {
+ a[href=u_node_slug(slug)] {
@node.get(NO_TITLE)
}
}
@@ -48,17 +48,17 @@ markup::define! {
@let slug = node.get(NO_SLUG).unwrap_or_default();
div[class="card wide"] {
div[class=&format!("poster {}", aspect_class(node))] {
- a[href=u_node_slug(&slug)] {
- img[src=cover_image(&node, 512), loading="lazy"];
+ a[href=u_node_slug(slug)] {
+ img[src=cover_image(node, 512), loading="lazy"];
}
.overlay {
@if node.has(NO_TRACK.0) {
- a.play.icon[href=u_node_slug_player(&slug)] { "play_arrow" }
+ a.play.icon[href=u_node_slug_player(slug)] { "play_arrow" }
}
}
}
div.details {
- a.title[href=u_node_slug(&slug)] { @node.get(NO_TITLE) }
+ a.title[href=u_node_slug(slug)] { @node.get(NO_TITLE) }
@Props { ri, nku ,full: false }
span.overview { @node.get(NO_DESCRIPTION) }
}
@@ -73,16 +73,16 @@ markup::define! {
.inner {
div.overview {
h2 { a[href=u_node_slug(slug)] { @node.get(NO_TITLE) } }
- @Props { ri, nku: *nku, full: false }
+ @Props { ri, nku, full: false }
p { b { @node.get(NO_TAGLINE) } " " @node.get(NO_DESCRIPTION) }
}
div[class=&format!("poster {}", aspect_class(node))] {
- a[href=u_node_slug(&slug)] {
- img[src=cover_image(&node, 512), loading="lazy"];
+ a[href=u_node_slug(slug)] {
+ img[src=cover_image(node, 512), loading="lazy"];
}
.overlay {
@if node.has(NO_TRACK.0) {
- a.play.icon[href=u_node_slug_player(&slug)] { "play_arrow" }
+ a.play.icon[href=u_node_slug_player(slug)] { "play_arrow" }
}
}
}
@@ -100,5 +100,5 @@ fn cover_image(node: &Object, size: usize) -> String {
{
return u_image_fallback_person(title, 512);
}
- return String::new();
+ String::new()
}
diff --git a/ui/src/components/node_page.rs b/ui/src/components/node_page.rs
index f640ec7..53dd904 100644
--- a/ui/src/components/node_page.rs
+++ b/ui/src/components/node_page.rs
@@ -166,7 +166,7 @@ markup::define! {
}}
}
@if !credited.is_empty() {
- h2 { @tr(ri.lang, &format!("node.credited")) }
+ h2 { @tr(ri.lang, "node.credited") }
ul.nl.grid { @for nku in *credited {
li { @NodeCard { ri, nku } }
}}
@@ -205,7 +205,8 @@ pub fn aspect_class(node: &Object) -> &'static str {
KIND_SEASON | KIND_SHOW | KIND_PERSON | KIND_SERIES | KIND_MOVIE | KIND_SHORTFORMVIDEO => {
"aspect-port"
}
- KIND_CHANNEL | KIND_MUSIC | _ => "aspect-square",
+ KIND_CHANNEL | KIND_MUSIC => "aspect-square",
+ _ => unreachable!(),
}
}