CI: Run clippy on all targets

pull/660/head
Tpt 1 year ago committed by Thomas Tanon
parent 5647624012
commit ea80c11d6e
  1. 24
      .github/workflows/tests.yml
  2. 2
      cli/src/main.rs
  3. 16
      lib/oxrdf/src/blank_node.rs
  4. 9
      lib/oxrdf/src/dataset.rs
  5. 2
      lib/oxrdf/src/literal.rs
  6. 9
      lib/oxrdfxml/src/serializer.rs
  7. 2
      lib/oxsdatatypes/src/boolean.rs
  8. 11
      lib/oxsdatatypes/src/date_time.rs
  9. 42
      lib/oxsdatatypes/src/decimal.rs
  10. 2
      lib/oxsdatatypes/src/double.rs
  11. 2
      lib/oxsdatatypes/src/duration.rs
  12. 2
      lib/oxsdatatypes/src/float.rs
  13. 28
      lib/oxsdatatypes/src/integer.rs
  14. 2
      lib/oxttl/src/trig.rs
  15. 2
      lib/oxttl/src/turtle.rs
  16. 2
      lib/sparesults/src/csv.rs
  17. 3
      lib/src/sparql/eval.rs
  18. 2
      lib/src/storage/binary_encoder.rs
  19. 10
      lib/tests/store.rs

@ -28,29 +28,29 @@ jobs:
submodules: true
- run: rustup update && rustup default 1.70.0 && rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxsdatatypes
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxrdf
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxrdfxml
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxttl
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/oxrdfio
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/sparesults
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/spargebra
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib/sparopt
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./lib
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./python
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./cli
- run: cargo clippy -- -D warnings -D clippy::all
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
working-directory: ./testsuite
clippy_wasm_js:

@ -1818,6 +1818,8 @@ fn systemd_notify_ready() -> io::Result<()> {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
use anyhow::Result;
use assert_cmd::Command;

@ -363,6 +363,8 @@ impl Error for BlankNodeIdParseError {}
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]
@ -379,13 +381,13 @@ mod tests {
#[test]
fn new_validation() {
assert!(BlankNode::new("").is_err());
assert!(BlankNode::new("a").is_ok());
assert!(BlankNode::new("-").is_err());
assert!(BlankNode::new("a-").is_ok());
assert!(BlankNode::new(".").is_err());
assert!(BlankNode::new("a.").is_err());
assert!(BlankNode::new("a.a").is_ok());
BlankNode::new("").unwrap_err();
BlankNode::new("a").unwrap();
BlankNode::new("-").unwrap_err();
BlankNode::new("a-").unwrap();
BlankNode::new(".").unwrap_err();
BlankNode::new("a.").unwrap_err();
BlankNode::new("a.a").unwrap();
}
#[test]

@ -1567,8 +1567,12 @@ type QuadsPerBlankNode = HashMap<
)>,
>;
#[test]
fn test_canon() {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_canon() {
let mut dataset = Dataset::new();
dataset.insert(QuadRef::new(
BlankNode::default().as_ref(),
@ -1598,4 +1602,5 @@ fn test_canon() {
));
dataset2.canonicalize();
assert_eq!(dataset, dataset2);
}
}

@ -636,6 +636,8 @@ pub fn print_quoted_str(string: &str, f: &mut impl Write) -> fmt::Result {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]

@ -338,8 +338,12 @@ fn split_iri(iri: &str) -> (&str, &str) {
}
}
#[test]
fn test_split_iri() {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_split_iri() {
assert_eq!(
split_iri("http://schema.org/Person"),
("http://schema.org/", "Person")
@ -350,4 +354,5 @@ fn test_split_iri() {
("http://schema.org#", "foo")
);
assert_eq!(split_iri("urn:isbn:foo"), ("urn:isbn:", "foo"));
}
}

@ -85,6 +85,8 @@ impl fmt::Display for Boolean {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]

@ -2452,6 +2452,8 @@ impl Error for InvalidTimezoneError {}
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]
@ -2613,9 +2615,9 @@ mod tests {
assert_eq!(GMonth::from_str("--01+01:00")?.to_string(), "--01+01:00");
assert_eq!(GMonth::from_str("--01")?.to_string(), "--01");
assert!(GYear::from_str("02020").is_err());
assert!(GYear::from_str("+2020").is_err());
assert!(GYear::from_str("33").is_err());
GYear::from_str("02020").unwrap_err();
GYear::from_str("+2020").unwrap_err();
GYear::from_str("33").unwrap_err();
assert_eq!(Time::from_str("00:00:00+14:00")?, Time::MIN);
assert_eq!(Time::from_str("24:00:00-14:00")?, Time::MAX);
@ -3155,10 +3157,9 @@ mod tests {
}
#[test]
fn g_year_month_from_date() -> Result<(), ParseDateTimeError> {
fn g_year_month_from_date() {
assert_eq!(GYearMonth::from(Date::MIN), GYearMonth::MIN);
assert_eq!(GYearMonth::from(Date::MAX), GYearMonth::MAX);
Ok(())
}
#[test]

@ -674,6 +674,8 @@ impl Error for TooLargeForDecimalError {}
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]
@ -688,14 +690,14 @@ mod tests {
#[test]
fn from_str() -> Result<(), ParseDecimalError> {
assert!(Decimal::from_str("").is_err());
assert!(Decimal::from_str("+").is_err());
assert!(Decimal::from_str("-").is_err());
assert!(Decimal::from_str(".").is_err());
assert!(Decimal::from_str("+.").is_err());
assert!(Decimal::from_str("-.").is_err());
assert!(Decimal::from_str("a").is_err());
assert!(Decimal::from_str(".a").is_err());
Decimal::from_str("").unwrap_err();
Decimal::from_str("+").unwrap_err();
Decimal::from_str("-").unwrap_err();
Decimal::from_str(".").unwrap_err();
Decimal::from_str("+.").unwrap_err();
Decimal::from_str("-.").unwrap_err();
Decimal::from_str("a").unwrap_err();
Decimal::from_str(".a").unwrap_err();
assert_eq!(Decimal::from_str("210")?.to_string(), "210");
assert_eq!(Decimal::from_str("1000")?.to_string(), "1000");
assert_eq!(Decimal::from_str("-1.23")?.to_string(), "-1.23");
@ -713,8 +715,8 @@ mod tests {
assert_eq!(Decimal::from_str("-0")?.to_string(), "0");
assert_eq!(Decimal::from_str(&Decimal::MAX.to_string())?, Decimal::MAX);
assert_eq!(Decimal::from_str(&Decimal::MIN.to_string())?, Decimal::MIN);
assert!(Decimal::from_str("0.0000000000000000001").is_err());
assert!(Decimal::from_str("1000000000000000000000").is_err());
Decimal::from_str("0.0000000000000000001").unwrap_err();
Decimal::from_str("1000000000000000000000").unwrap_err();
assert_eq!(
Decimal::from_str("0.100000000000000000000000000").unwrap(),
Decimal::from_str("0.1").unwrap()
@ -1019,11 +1021,11 @@ mod tests {
Decimal::try_from(Float::from(-123.5)).ok(),
Some(Decimal::from_str("-123.5")?)
);
assert!(Decimal::try_from(Float::from(f32::NAN)).is_err());
assert!(Decimal::try_from(Float::from(f32::INFINITY)).is_err());
assert!(Decimal::try_from(Float::from(f32::NEG_INFINITY)).is_err());
assert!(Decimal::try_from(Float::from(f32::MIN)).is_err());
assert!(Decimal::try_from(Float::from(f32::MAX)).is_err());
Decimal::try_from(Float::from(f32::NAN)).unwrap_err();
Decimal::try_from(Float::from(f32::INFINITY)).unwrap_err();
Decimal::try_from(Float::from(f32::NEG_INFINITY)).unwrap_err();
Decimal::try_from(Float::from(f32::MIN)).unwrap_err();
Decimal::try_from(Float::from(f32::MAX)).unwrap_err();
assert!(
Decimal::try_from(Float::from(1_672_507_300_000.))
.unwrap()
@ -1059,11 +1061,11 @@ mod tests {
.unwrap()
< Decimal::from(1)
);
assert!(Decimal::try_from(Double::from(f64::NAN)).is_err());
assert!(Decimal::try_from(Double::from(f64::INFINITY)).is_err());
assert!(Decimal::try_from(Double::from(f64::NEG_INFINITY)).is_err());
assert!(Decimal::try_from(Double::from(f64::MIN)).is_err());
assert!(Decimal::try_from(Double::from(f64::MAX)).is_err());
Decimal::try_from(Double::from(f64::NAN)).unwrap_err();
Decimal::try_from(Double::from(f64::INFINITY)).unwrap_err();
Decimal::try_from(Double::from(f64::NEG_INFINITY)).unwrap_err();
Decimal::try_from(Double::from(f64::MIN)).unwrap_err();
Decimal::try_from(Double::from(f64::MAX)).unwrap_err();
Ok(())
}

@ -261,6 +261,8 @@ impl Div for Double {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]

@ -996,6 +996,8 @@ impl From<OppositeSignInDurationComponentsError> for ParseDurationError {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]

@ -251,6 +251,8 @@ impl Div for Float {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]

@ -278,6 +278,8 @@ impl Error for TooLargeForIntegerError {}
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]
@ -286,7 +288,7 @@ mod tests {
assert_eq!(Integer::from_str("-0")?.to_string(), "0");
assert_eq!(Integer::from_str("123")?.to_string(), "123");
assert_eq!(Integer::from_str("-123")?.to_string(), "-123");
assert!(Integer::from_str("123456789123456789123456789123456789123456789").is_err());
Integer::from_str("123456789123456789123456789123456789123456789").unwrap_err();
Ok(())
}
@ -304,11 +306,11 @@ mod tests {
Integer::try_from(Float::from(-123.1)).ok(),
Some(Integer::from_str("-123")?)
);
assert!(Integer::try_from(Float::from(f32::NAN)).is_err());
assert!(Integer::try_from(Float::from(f32::INFINITY)).is_err());
assert!(Integer::try_from(Float::from(f32::NEG_INFINITY)).is_err());
assert!(Integer::try_from(Float::from(f32::MIN)).is_err());
assert!(Integer::try_from(Float::from(f32::MAX)).is_err());
Integer::try_from(Float::from(f32::NAN)).unwrap_err();
Integer::try_from(Float::from(f32::INFINITY)).unwrap_err();
Integer::try_from(Float::from(f32::NEG_INFINITY)).unwrap_err();
Integer::try_from(Float::from(f32::MIN)).unwrap_err();
Integer::try_from(Float::from(f32::MAX)).unwrap_err();
assert!(
Integer::try_from(Float::from(1_672_507_300_000.))
.unwrap()
@ -344,11 +346,11 @@ mod tests {
.unwrap()
< Integer::from(10)
);
assert!(Integer::try_from(Double::from(f64::NAN)).is_err());
assert!(Integer::try_from(Double::from(f64::INFINITY)).is_err());
assert!(Integer::try_from(Double::from(f64::NEG_INFINITY)).is_err());
assert!(Integer::try_from(Double::from(f64::MIN)).is_err());
assert!(Integer::try_from(Double::from(f64::MAX)).is_err());
Integer::try_from(Double::from(f64::NAN)).unwrap_err();
Integer::try_from(Double::from(f64::INFINITY)).unwrap_err();
Integer::try_from(Double::from(f64::NEG_INFINITY)).unwrap_err();
Integer::try_from(Double::from(f64::MIN)).unwrap_err();
Integer::try_from(Double::from(f64::MAX)).unwrap_err();
Ok(())
}
@ -362,8 +364,8 @@ mod tests {
Integer::try_from(Decimal::from_str("-123.1").unwrap()).ok(),
Some(Integer::from_str("-123")?)
);
assert!(Integer::try_from(Decimal::MIN).is_err());
assert!(Integer::try_from(Decimal::MAX).is_err());
Integer::try_from(Decimal::MIN).unwrap_err();
Integer::try_from(Decimal::MAX).unwrap_err();
Ok(())
}

@ -860,6 +860,8 @@ fn is_turtle_double(value: &str) -> bool {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
use oxrdf::vocab::xsd;
use oxrdf::{BlankNodeRef, GraphNameRef, LiteralRef, NamedNodeRef};

@ -666,6 +666,8 @@ impl LowLevelTurtleWriter {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
use oxrdf::{BlankNodeRef, LiteralRef, NamedNodeRef};

@ -475,6 +475,8 @@ impl LineReader {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
use std::error::Error;
use std::rc::Rc;

@ -5873,7 +5873,10 @@ impl Timer {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
#[test]
fn uuid() {
let mut buffer = String::default();

@ -633,6 +633,8 @@ pub fn write_term(sink: &mut Vec<u8>, term: &EncodedTerm) {
#[cfg(test)]
mod tests {
#![allow(clippy::panic_in_result_fn)]
use super::*;
use crate::model::TermRef;
use crate::storage::numeric_encoder::*;

@ -291,15 +291,15 @@ fn test_bad_stt_open() -> Result<(), Box<dyn Error>> {
let dir = TempDir::default();
let store = Store::open(&dir.0)?;
remove_dir_all(&dir.0)?;
assert!(store
store
.bulk_loader()
.load_quads(once(Quad::new(
NamedNode::new_unchecked("http://example.com/s"),
NamedNode::new_unchecked("http://example.com/p"),
NamedNode::new_unchecked("http://example.com/o"),
GraphName::DefaultGraph
GraphName::DefaultGraph,
)))
.is_err());
.unwrap_err();
Ok(())
}
@ -350,7 +350,7 @@ fn test_bad_backup() -> Result<(), Box<dyn Error>> {
let backup_dir = TempDir::default();
create_dir_all(&backup_dir.0)?;
assert!(Store::open(&store_dir)?.backup(&backup_dir.0).is_err());
Store::open(&store_dir)?.backup(&backup_dir.0).unwrap_err();
Ok(())
}
@ -358,7 +358,7 @@ fn test_bad_backup() -> Result<(), Box<dyn Error>> {
#[cfg(not(target_family = "wasm"))]
fn test_backup_on_in_memory() -> Result<(), Box<dyn Error>> {
let backup_dir = TempDir::default();
assert!(Store::new()?.backup(&backup_dir).is_err());
Store::new()?.backup(&backup_dir).unwrap_err();
Ok(())
}

Loading…
Cancel
Save