run clippy on default, all, and allocator features

This way all 4 major configurations are linted.
This commit is contained in:
Charles Hall 2024-04-27 16:21:53 -07:00 committed by June
parent 838550536a
commit 4faf690f57
2 changed files with 99 additions and 59 deletions

View file

@ -78,7 +78,19 @@ RUSTDOCFLAGS="-D warnings" cargo doc \
""" """
[[task]] [[task]]
name = "cargo-clippy" name = "clippy/default"
group = "lints"
script = """
cargo clippy \
--workspace \
--all-targets \
--color=always \
-- \
-D warnings
"""
[[task]]
name = "clippy/all"
group = "lints" group = "lints"
script = """ script = """
cargo clippy \ cargo clippy \
@ -90,6 +102,32 @@ cargo clippy \
-D warnings -D warnings
""" """
[[task]]
name = "clippy/jemalloc"
group = "lints"
script = """
cargo clippy \
--workspace \
--features jemalloc \
--all-targets \
--color=always \
-- \
-D warnings
"""
[[task]]
name = "clippy/hardened_malloc"
group = "lints"
script = """
cargo clippy \
--workspace \
--features hardened_malloc \
--all-targets \
--color=always \
-- \
-D warnings
"""
[[task]] [[task]]
name = "lychee" name = "lychee"
group = "lints" group = "lints"

View file

@ -476,6 +476,9 @@ impl Service {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[cfg(feature = "sha256_media")]
#[tokio::test]
async fn long_file_names_works() {
use std::path::PathBuf; use std::path::PathBuf;
use base64::{engine::general_purpose, Engine as _}; use base64::{engine::general_purpose, Engine as _};
@ -486,8 +489,8 @@ mod tests {
impl Data for MockedKVDatabase { impl Data for MockedKVDatabase {
fn create_file_metadata( fn create_file_metadata(
&self, _sender_user: Option<&str>, mxc: String, width: u32, height: u32, content_disposition: Option<&str>, &self, _sender_user: Option<&str>, mxc: String, width: u32, height: u32,
content_type: Option<&str>, content_disposition: Option<&str>, content_type: Option<&str>,
) -> Result<Vec<u8>> { ) -> Result<Vec<u8>> {
// copied from src/database/key_value/media.rs // copied from src/database/key_value/media.rs
let mut key = mxc.as_bytes().to_vec(); let mut key = mxc.as_bytes().to_vec();
@ -526,16 +529,15 @@ mod tests {
fn remove_url_preview(&self, _url: &str) -> Result<()> { todo!() } fn remove_url_preview(&self, _url: &str) -> Result<()> { todo!() }
fn set_url_preview(&self, _url: &str, _data: &UrlPreviewData, _timestamp: std::time::Duration) -> Result<()> { fn set_url_preview(
&self, _url: &str, _data: &UrlPreviewData, _timestamp: std::time::Duration,
) -> Result<()> {
todo!() todo!()
} }
fn get_url_preview(&self, _url: &str) -> Option<UrlPreviewData> { todo!() } fn get_url_preview(&self, _url: &str) -> Option<UrlPreviewData> { todo!() }
} }
#[tokio::test]
#[cfg(feature = "sha256_media")]
async fn long_file_names_works() {
static DB: MockedKVDatabase = MockedKVDatabase; static DB: MockedKVDatabase = MockedKVDatabase;
let media = Service { let media = Service {
db: &DB, db: &DB,