Skip to content

Commit

Permalink
Fix some nightly clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Lauzier authored and Grokmoo committed Jun 18, 2021
1 parent ba320c7 commit 4e9b472
Show file tree
Hide file tree
Showing 101 changed files with 324 additions and 324 deletions.
2 changes: 1 addition & 1 deletion sulis_core/src/image/animated_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl AnimatedImage {
image_id
));
}
Some(ref image) => Rc::clone(image),
Some(image) => Rc::clone(image),
};

match size {
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/image/timer_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl TimerImage {
}
}

frames.push(Rc::clone(&image));
frames.push(Rc::clone(image));
}

let total_frame_time = builder.frame_time_millis * frames.len() as u32;
Expand Down
8 changes: 4 additions & 4 deletions sulis_core/src/io/glium_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ impl<'a> GliumRenderer<'a> {
draw_list.kind
);
let image = match draw_list.kind {
DrawListKind::Sprite => ResourceSet::spritesheet(&texture_id).unwrap().image.clone(),
DrawListKind::Font => ResourceSet::font(&texture_id).unwrap().image.clone(),
DrawListKind::Sprite => ResourceSet::spritesheet(texture_id).unwrap().image.clone(),
DrawListKind::Font => ResourceSet::font(texture_id).unwrap().image.clone(),
};

self.register_texture(
Expand Down Expand Up @@ -289,7 +289,7 @@ impl<'a> GraphicsRenderer for GliumRenderer<'a> {
glium::framebuffer::SimpleFrameBuffer::new(&self.display.display, &texture.texture)
.unwrap();

draw_to_surface(&mut framebuffer, draw_list, &self.display, &self.params);
draw_to_surface(&mut framebuffer, draw_list, self.display, &self.params);
}

fn draw(&mut self, draw_list: DrawList) {
Expand All @@ -298,7 +298,7 @@ impl<'a> GraphicsRenderer for GliumRenderer<'a> {
}
self.create_texture_if_missing(&draw_list.texture, &draw_list);

draw_to_surface(self.target, draw_list, &self.display, &self.params);
draw_to_surface(self.target, draw_list, self.display, &self.params);
}
}

Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/io/input_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ impl InputAction {
debug!("Firing action {:?}", action);

let event = Event::new(Kind::KeyPress(action));
Widget::dispatch_event(&root, event);
Widget::dispatch_event(root, event);
}
}
4 changes: 2 additions & 2 deletions sulis_core/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl ResourceSet {
let yaml_start = std::time::Instant::now();
let root = dirs.remove(0);
let path = Path::new(&root);
let mut yaml = YamlResourceSet::new(&path)?;
let mut yaml = YamlResourceSet::new(path)?;

for dir in dirs {
let path = Path::new(&dir);
Expand Down Expand Up @@ -345,7 +345,7 @@ impl ResourceSet {
sprite_id, spritesheet_id
));
}
Some(ref sprite) => Rc::clone(sprite),
Some(sprite) => Rc::clone(sprite),
};

Ok(sprite)
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/resource/sound_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn build_source(
};

let s_id = format!("{}/{}", builder_id, entry_id);
if let Ok(sound_source) = SoundSource::new(s_id, file, &entry_builder) {
if let Ok(sound_source) = SoundSource::new(s_id, file, entry_builder) {
source = Some(sound_source);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/resource/yaml_resource_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl YamlResourceKind {
warn!("{}", e);
return None;
}
Ok(ref path) => path.to_string_lossy().to_string(),
Ok(path) => path.to_string_lossy().to_string(),
};

YamlResourceKind::from_str(&path_str)
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/ui/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn float_one() -> f32 {
}

fn get_component(text: &str, max: f32) -> f32 {
let component = i32::from_str_radix(&text, 16);
let component = i32::from_str_radix(text, 16);
match component {
Err(_) => {
warn!("Unable to parse color component from '{}'", text);
Expand Down
10 changes: 5 additions & 5 deletions sulis_core/src/ui/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ impl Cursor {
}

// mouse move event below should recreate mouse over as needed
Widget::remove_mouse_over(&root);
Widget::remove_mouse_over(root);
trace!("Cursor move by {}, {}", x, y);

let event = Event::new(event::Kind::MouseMove {
delta_x: x,
delta_y: y,
});
Widget::dispatch_event(&root, event);
Widget::dispatch_event(root, event);

if let Some(kind) = Cursor::button_down() {
trace!("Cursor {:?} drag.", kind);
Expand All @@ -126,7 +126,7 @@ impl Cursor {
delta_x: x,
delta_y: y,
});
Widget::dispatch_event(&root, event);
Widget::dispatch_event(root, event);
}
}

Expand All @@ -141,7 +141,7 @@ impl Cursor {

trace!("Cursor pressed at {},{}", x, y);
let event = Event::new(event::Kind::MousePress(kind));
Widget::dispatch_event(&root, event);
Widget::dispatch_event(root, event);
}

pub fn release(root: &Rc<RefCell<Widget>>, kind: event::ClickKind) {
Expand All @@ -150,7 +150,7 @@ impl Cursor {

trace!("Cursor released at {},{}", x, y);
let event = Event::new(event::Kind::MouseRelease(kind));
Widget::dispatch_event(&root, event);
Widget::dispatch_event(root, event);
}

pub fn move_by_internal(x: f32, y: f32) -> bool {
Expand Down
22 changes: 11 additions & 11 deletions sulis_core/src/ui/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Widget {

self.kind
.borrow_mut()
.draw(renderer, pixel_size, &self, millis);
.draw(renderer, pixel_size, self, millis);

for child in self.children.iter() {
let child = child.borrow();
Expand Down Expand Up @@ -321,7 +321,7 @@ impl Widget {
if child_ref.state.is_modal {
trace!("Adding child as modal widget.");
let root = Widget::get_root(parent);
root.borrow_mut().modal_child = Some(Rc::clone(&child));
root.borrow_mut().modal_child = Some(Rc::clone(child));
root.borrow_mut().keyboard_focus_child = None;
}
}
Expand Down Expand Up @@ -470,7 +470,7 @@ impl Widget {
}

pub fn update(root: &Rc<RefCell<Widget>>, millis: u32) -> Result<(), Error> {
Widget::update_kind_recursive(&root, millis);
Widget::update_kind_recursive(root, millis);

let mut find_new_modal = false;
if let Some(ref child) = root.borrow().modal_child {
Expand All @@ -479,15 +479,15 @@ impl Widget {
}
}

Widget::check_children_removal(&root);
Widget::check_children_removal(root);

if find_new_modal {
let modal = Widget::find_new_modal_child(root);
root.borrow_mut().modal_child = modal;
}

Widget::check_readd(&root);
Widget::check_children(&root)?;
Widget::check_readd(root);
Widget::check_children(root)?;

root.borrow_mut().layout_widget();

Expand All @@ -496,7 +496,7 @@ impl Widget {

fn update_kind_recursive(widget: &Rc<RefCell<Widget>>, millis: u32) {
let kind = Rc::clone(&widget.borrow().kind);
kind.borrow_mut().update(&widget, millis);
kind.borrow_mut().update(widget, millis);

let len = widget.borrow().children.len();
for i in 0..len {
Expand All @@ -511,12 +511,12 @@ impl Widget {
parent.borrow_mut().modal_child = None;
for child in parent.borrow_mut().children.iter() {
let kind = Rc::clone(&child.borrow().kind);
kind.borrow_mut().on_remove(&child);
kind.borrow_mut().on_remove(child);
}
parent.borrow_mut().children.clear();
let kind = Rc::clone(&parent.borrow().kind);
kind.borrow_mut().on_remove(&parent);
let children = kind.borrow_mut().on_add(&parent);
kind.borrow_mut().on_remove(parent);
let children = kind.borrow_mut().on_add(parent);
Widget::add_children_to(parent, children);
parent.borrow_mut().marked_for_readd = false;
parent.borrow_mut().marked_for_layout = true;
Expand All @@ -541,7 +541,7 @@ impl Widget {
}

let kind = Rc::clone(&widget.borrow().kind);
kind.borrow_mut().on_remove(&widget);
kind.borrow_mut().on_remove(widget);
}

fn find_new_modal_child(parent: &Rc<RefCell<Widget>>) -> Option<Rc<RefCell<Widget>>> {
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Ord for ExtInt {
fn cmp(&self, other: &ExtInt) -> Ordering {
match self {
ExtInt::Int(val) => match other {
ExtInt::Int(other) => val.cmp(&other),
ExtInt::Int(other) => val.cmp(other),
ExtInt::Infinity => Ordering::Less,
},
ExtInt::Infinity => match other {
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/util/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Ord for Point {

impl PartialOrd for Point {
fn partial_cmp(&self, other: &Point) -> Option<cmp::Ordering> {
Some(self.cmp(&other))
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/widgets/input_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl WidgetKind for InputField {
}

let theme = &widget.theme;
if let Some(ref image_id) = theme.custom.get("carat_image") {
if let Some(image_id) = theme.custom.get("carat_image") {
self.carat = ResourceSet::image(image_id);
}

Expand Down
4 changes: 2 additions & 2 deletions sulis_core/src/widgets/markup_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl MarkupRenderer {
markup_stack.push(cur_markup);
cur_markup = Markup::from_string(
&markup_buf,
&markup_stack.last().unwrap(),
markup_stack.last().unwrap(),
widget_state,
);
markup_buf.clear();
Expand All @@ -256,7 +256,7 @@ impl MarkupRenderer {
x = pos_x + right_x - text_width_until_tag_close;
}
if let Some(ref image) = cur_markup.image {
self.draw_sprite(&image, &cur_markup, x, y);
self.draw_sprite(image, &cur_markup, x, y);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion sulis_core/src/widgets/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl WidgetKind for ProgressBar {
widget.state.text_renderer = Some(Box::new(LineRenderer::new(font)));
}

if let Some(ref image_id) = widget.theme.custom.get("bar_image") {
if let Some(image_id) = widget.theme.custom.get("bar_image") {
self.bar = ResourceSet::image(image_id);
}

Expand Down
4 changes: 2 additions & 2 deletions sulis_core/src/widgets/scrollpane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl WidgetKind for Scrollbar {
.borrow_mut()
.state
.add_callback(Callback::new(Rc::new(move |widget, _| {
let (_, kind) = Widget::parent_mut::<Scrollbar>(&widget);
let (_, kind) = Widget::parent_mut::<Scrollbar>(widget);
kind.update_children_position(&widget_ref, -1);
})));

Expand All @@ -405,7 +405,7 @@ impl WidgetKind for Scrollbar {
.borrow_mut()
.state
.add_callback(Callback::new(Rc::new(move |widget, _| {
let (_, kind) = Widget::parent_mut::<Scrollbar>(&widget);
let (_, kind) = Widget::parent_mut::<Scrollbar>(widget);
kind.update_children_position(&widget_ref, 1);
})));

Expand Down
2 changes: 1 addition & 1 deletion sulis_module/src/ability_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl AbilityList {
warn!("Unable to find ability '{}'", entry.id);
return unable_to_create_error("ability_list", &builder.id);
}
Some(ref ability) => Rc::clone(ability),
Some(ability) => Rc::clone(ability),
};

entries.push(Entry {
Expand Down
4 changes: 2 additions & 2 deletions sulis_module/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl Actor {
warn!("No ability found for '{}'", ability_id);
return unable_to_create_error("actor", &builder.id);
}
Some(ref ability) => Rc::clone(ability),
Some(ability) => Rc::clone(ability),
};

let mut upgrade = false;
Expand All @@ -357,7 +357,7 @@ impl Actor {
warn!("No AI template found with id '{}'", id);
return unable_to_create_error("actor", &builder.id);
}
Some(ref ai) => Some(Rc::clone(ai)),
Some(ai) => Some(Rc::clone(ai)),
},
};

Expand Down
4 changes: 2 additions & 2 deletions sulis_module/src/area/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Tileset {
}

fn move_uniform(&mut self) {
for (_, ref uniform) in self.uniform_sets.iter() {
for (_, uniform) in self.uniform_sets.iter() {
let size = uniform.size;
let layer = &uniform.layer;
let prefix = &uniform.sprite_prefix;
Expand Down Expand Up @@ -266,7 +266,7 @@ impl Tileset {
}

fn move_non_uniform(&mut self) {
for (_, ref non_uniform) in self.non_uniform_sets.iter() {
for (_, non_uniform) in self.non_uniform_sets.iter() {
let size = non_uniform.size;
let layer = &non_uniform.layer;
let prefix = &non_uniform.sprite_prefix;
Expand Down
6 changes: 3 additions & 3 deletions sulis_module/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Class {
warn!("Unable to find ability list '{}'", ability_list_id);
return unable_to_create_error("class", &builder.id);
}
Some(ref ability_list) => Rc::clone(ability_list),
Some(ability_list) => Rc::clone(ability_list),
};

ability_choices.push(ability_list);
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Class {
warn!("Unable to find ability '{}'", ability_id);
return unable_to_create_error("class", &builder.id);
}
Some(ref ability) => Rc::clone(ability),
Some(ability) => Rc::clone(ability),
};

abilities.push(ability);
Expand All @@ -123,7 +123,7 @@ impl Class {
warn!("Unable to find ability '{}'", ability_id);
return unable_to_create_error("class", &builder.id);
}
Some(ref ability) => Rc::clone(ability),
Some(ability) => Rc::clone(ability),
};

abilities.push(ability);
Expand Down
Loading

0 comments on commit 4e9b472

Please sign in to comment.