Skip to content

Commit

Permalink
Fix and work around excessively strict dead_code lint in Rust 1.78 ni…
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark committed Feb 21, 2024
1 parent 93b3e0a commit 865b467
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
1 change: 1 addition & 0 deletions rsvg/src/float_eq_cairo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fn cairo_fixed_from_double(d: f64) -> i32 {
/// the integral part, and 8 bits for the fractional part. That is,
/// the smallest fraction they can represent is 1/256.
pub trait FixedEqCairo {
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/120770
fn fixed_eq_cairo(&self, other: &Self) -> bool;
}

Expand Down
27 changes: 0 additions & 27 deletions rsvg_convert/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,33 +1232,6 @@ fn parse_zoom_factor(v: &str) -> Result<ZoomFactor, String> {
}
}

trait NotFound {
type Ok;
type Error;

fn or_none(self) -> Result<Option<Self::Ok>, Self::Error>;
}

impl<T> NotFound for Result<T, clap::Error> {
type Ok = T;
type Error = clap::Error;

/// Maps the Result to an Option, translating the ArgumentNotFound error to
/// Ok(None), while mapping other kinds of errors to Err(e).
///
/// This allows to get proper error reporting for invalid values on optional
/// arguments.
fn or_none(self) -> Result<Option<T>, clap::Error> {
self.map_or_else(
|e| match e.kind() {
clap::error::ErrorKind::UnknownArgument => Ok(None),
_ => Err(e),
},
|v| Ok(Some(v)),
)
}
}

fn parse_background_color(s: &str) -> Result<Option<Color>, String> {
match s {
"none" | "None" => Ok(None),
Expand Down
4 changes: 0 additions & 4 deletions rsvg_convert/tests/internal_predicates/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ impl cmp::PartialEq for Dimensions {

impl cmp::Eq for Dimensions {}

trait Details {
fn get_size(&self) -> Option<Dimensions>;
}

impl DetailPredicate<SvgPredicate> {
fn eval_doc(&self, handle: &SvgHandle) -> bool {
match &self.d {
Expand Down

0 comments on commit 865b467

Please sign in to comment.