Skip to content

Commit 865b467

Browse files
committed
Fix and work around excessively strict dead_code lint in Rust 1.78 nightly
See rust-lang/rust#120770 Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/927>
1 parent 93b3e0a commit 865b467

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

rsvg/src/float_eq_cairo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fn cairo_fixed_from_double(d: f64) -> i32 {
2929
/// the integral part, and 8 bits for the fractional part. That is,
3030
/// the smallest fraction they can represent is 1/256.
3131
pub trait FixedEqCairo {
32+
#[allow(dead_code)] // https://github.com/rust-lang/rust/issues/120770
3233
fn fixed_eq_cairo(&self, other: &Self) -> bool;
3334
}
3435

rsvg_convert/src/main.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,33 +1232,6 @@ fn parse_zoom_factor(v: &str) -> Result<ZoomFactor, String> {
12321232
}
12331233
}
12341234

1235-
trait NotFound {
1236-
type Ok;
1237-
type Error;
1238-
1239-
fn or_none(self) -> Result<Option<Self::Ok>, Self::Error>;
1240-
}
1241-
1242-
impl<T> NotFound for Result<T, clap::Error> {
1243-
type Ok = T;
1244-
type Error = clap::Error;
1245-
1246-
/// Maps the Result to an Option, translating the ArgumentNotFound error to
1247-
/// Ok(None), while mapping other kinds of errors to Err(e).
1248-
///
1249-
/// This allows to get proper error reporting for invalid values on optional
1250-
/// arguments.
1251-
fn or_none(self) -> Result<Option<T>, clap::Error> {
1252-
self.map_or_else(
1253-
|e| match e.kind() {
1254-
clap::error::ErrorKind::UnknownArgument => Ok(None),
1255-
_ => Err(e),
1256-
},
1257-
|v| Ok(Some(v)),
1258-
)
1259-
}
1260-
}
1261-
12621235
fn parse_background_color(s: &str) -> Result<Option<Color>, String> {
12631236
match s {
12641237
"none" | "None" => Ok(None),

rsvg_convert/tests/internal_predicates/svg.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ impl cmp::PartialEq for Dimensions {
105105

106106
impl cmp::Eq for Dimensions {}
107107

108-
trait Details {
109-
fn get_size(&self) -> Option<Dimensions>;
110-
}
111-
112108
impl DetailPredicate<SvgPredicate> {
113109
fn eval_doc(&self, handle: &SvgHandle) -> bool {
114110
match &self.d {

0 commit comments

Comments
 (0)