mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
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:
parent
f855bd09d1
commit
e3672eb4e0
10 changed files with 39 additions and 30 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue