enable unused_self lint

Functions using `services()` are allowed to pointlessly take `self`
because the existence of `services()` is a crime and the solution is
making the types store references to their dependencies and then going
through `self`, so just allowing the lint saves us from modifying some
code only to switch it back later. Much later. Getting rid of
`services()` will probably be an ordeal.
This commit is contained in:
Charles Hall 2024-05-14 19:40:35 -07:00
parent f855bd09d1
commit e3672eb4e0
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
10 changed files with 39 additions and 30 deletions

View file

@ -86,7 +86,7 @@ impl Service {
/// Returns width, height of the thumbnail and whether it should be cropped. Returns None when
/// the server should send the original file.
pub(crate) fn thumbnail_properties(&self, width: u32, height: u32) -> Option<(u32, u32, bool)> {
fn thumbnail_properties(width: u32, height: u32) -> Option<(u32, u32, bool)> {
match (width, height) {
(0..=32, 0..=32) => Some((32, 32, true)),
(0..=96, 0..=96) => Some((96, 96, true)),
@ -113,9 +113,8 @@ impl Service {
width: u32,
height: u32,
) -> Result<Option<FileMeta>> {
let (width, height, crop) = self
.thumbnail_properties(width, height)
.unwrap_or((0, 0, false)); // 0, 0 because that's the original file
let (width, height, crop) =
Self::thumbnail_properties(width, height).unwrap_or((0, 0, false)); // 0, 0 because that's the original file
if let Ok((content_disposition, content_type, key)) =
self.db.search_file_metadata(mxc.clone(), width, height)