Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning #1428

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions backends/conrod_gfx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,14 +815,6 @@ impl From<gfx::PipelineStateError<String>> for RendererCreationError {
}
}

impl std::error::Error for RendererCreationError {
fn description(&self) -> &str {
match *self {
RendererCreationError::PipelineState(ref e) => std::error::Error::description(e),
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave the std::error::Error implementations and only remove the inner description methods instead? Otherwise I think we might break some downstream crates that rely on these error types implementing the std::error::Error trait.


impl std::fmt::Display for RendererCreationError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match *self {
Expand Down
10 changes: 5 additions & 5 deletions backends/conrod_glium/examples/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ fn set_widgets(ui: &mut conrod_core::UiCell, ids: &Ids, graph: &mut MyGraph, lay
Event::Node(event) => match event {
// NodeEvent::Add(node_kind) => {
// },
NodeEvent::Remove(node_id) => {}
NodeEvent::Remove(_node_id) => {}
NodeEvent::Dragged { node_id, to, .. } => {
*layout.get_mut(&node_id).unwrap() = to;
}
},
Event::Edge(event) => match event {
EdgeEvent::AddStart(node_socket) => {}
EdgeEvent::Add { start, end } => {}
EdgeEvent::Cancelled(node_socket) => {}
EdgeEvent::Remove { start, end } => {}
EdgeEvent::AddStart(_node_socket) => {}
EdgeEvent::Add { start: _, end: _ } => {}
EdgeEvent::Cancelled(_node_socket) => {}
EdgeEvent::Remove { start: _, end: _ } => {}
},
}
}
Expand Down
18 changes: 0 additions & 18 deletions backends/conrod_glium/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,15 +1020,6 @@ impl From<glium::program::ProgramChooserCreationError> for RendererCreationError
}
}

impl std::error::Error for RendererCreationError {
fn description(&self) -> &str {
match *self {
RendererCreationError::Texture(ref e) => std::error::Error::description(e),
RendererCreationError::Program(ref e) => std::error::Error::description(e),
}
}
}

impl std::fmt::Display for RendererCreationError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match *self {
Expand All @@ -1050,15 +1041,6 @@ impl From<glium::DrawError> for DrawError {
}
}

impl std::error::Error for DrawError {
fn description(&self) -> &str {
match *self {
DrawError::Buffer(ref e) => std::error::Error::description(e),
DrawError::Draw(ref e) => std::error::Error::description(e),
}
}
}

impl std::fmt::Display for DrawError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match *self {
Expand Down
4 changes: 2 additions & 2 deletions conrod_core/src/position/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ pub enum Dimension {
/// Thus, **Positionable** can be implemented for *all* types that implement **Widget**.
pub trait Positionable: Sized {
/// Build with the given **Position** along the *x* axis.
fn x_position(self, Position) -> Self;
fn x_position(self, _: Position) -> Self;

/// Build with the given **Position** along the *y* axis.
fn y_position(self, Position) -> Self;
fn y_position(self, _: Position) -> Self;

/// Get the **Position** along the *x* axis.
fn get_x_position(&self, ui: &Ui) -> Position;
Expand Down
8 changes: 4 additions & 4 deletions conrod_core/src/widget/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ pub trait Direction {
type Axis: widget::scrollbar::Axis;

/// For some given `Rect`, returns the parallel and perpendicular ranges respectively.
fn ranges(Rect) -> (Range, Range);
fn ranges(_: Rect) -> (Range, Range);

/// Begin building the scrollbar for the `List`.
fn scrollbar(widget::Id) -> widget::Scrollbar<Self::Axis>;
fn scrollbar(_: widget::Id) -> widget::Scrollbar<Self::Axis>;

/// Borrow the scroll state associated with this `Direction`'s axis.
fn common_scroll(common: &widget::CommonBuilder) -> Option<&widget::scroll::Scroll>;
Expand Down Expand Up @@ -105,8 +105,8 @@ pub trait Direction {
pub trait ItemSize: Sized + Clone + Copy {
/// Update the `List` widget.
fn update_list<D>(
List<D, Self>,
widget::UpdateArgs<List<D, Self>>,
_: List<D, Self>,
_: widget::UpdateArgs<List<D, Self>>,
) -> <List<D, Self> as Widget>::Event
where
D: Direction;
Expand Down
12 changes: 6 additions & 6 deletions conrod_core/src/widget/list_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ pub trait Mode {
/// Update the `PendingEvents` in accordance with the given `Click` event.
fn click_selection<F, D, S>(
&self,
event::Click,
_: event::Click,
i: usize,
num_items: usize,
&State,
_: &State,
is_selected: F,
&mut PendingEvents<Self::Selection, D, S>,
_: &mut PendingEvents<Self::Selection, D, S>,
) where
F: Fn(usize) -> bool;

/// Update the `PendingEvents` in accordance with the given `KeyPress` event.
fn key_selection<F, D, S>(
&self,
event::KeyPress,
_: event::KeyPress,
i: usize,
num_items: usize,
&State,
_: &State,
is_selected: F,
&mut PendingEvents<Self::Selection, D, S>,
_: &mut PendingEvents<Self::Selection, D, S>,
) where
F: Fn(usize) -> bool,
D: Direction;
Expand Down
2 changes: 1 addition & 1 deletion conrod_core/src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ pub trait Widget: Common + Sized {
///
/// The `Ui` will only call this once, immediately prior to the first time that
/// **Widget::update** is first called.
fn init_state(&self, id::Generator) -> Self::State;
fn init_state(&self, _: id::Generator) -> Self::State;

/// Return the styling of the widget.
///
Expand Down
2 changes: 1 addition & 1 deletion conrod_core/src/widget/primitive/shape/triangles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait Vertex: Clone + Copy + PartialEq {
/// The x y location of the vertex.
fn point(&self) -> Point;
/// Add the given vector onto the position of self and return the result.
fn add(self, Point) -> Self;
fn add(self, _: Point) -> Self;
}

/// Unique styling types for `Triangles`.
Expand Down
6 changes: 3 additions & 3 deletions conrod_core/src/widget/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ pub struct State<A> {
/// Methods for distinguishing behaviour between both scroll axes at compile-time.
pub trait Axis {
/// The range of the given `Rect` that is parallel with this `Axis`.
fn parallel_range(Rect) -> Range;
fn parallel_range(_: Rect) -> Range;
/// The range of the given `Rect` that is perpendicular with this `Axis`.
fn perpendicular_range(Rect) -> Range;
fn perpendicular_range(_: Rect) -> Range;
/// Given some rectangular `Padding`, return the `Range` that corresponds with this `Axis`.
fn padding_range(Padding) -> Range;
fn padding_range(_: Padding) -> Range;
/// The coordinate of the given mouse position that corresponds with this `Axis`.
fn mouse_scalar(mouse_xy: Point) -> Scalar;
/// A `Scalar` multiplier representing the direction in which positive offset shifts the
Expand Down