Clippy fixes

This commit is contained in:
Joonas Javanainen 2017-11-06 20:10:39 +02:00
parent 85f18abeee
commit d7e9e17aa3
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
5 changed files with 20 additions and 22 deletions

View File

@ -34,14 +34,12 @@ pub fn run<F: FnMut(&Ui) -> bool>(title: String, clear_color: [f32; 4], mut run_
} else {
Shaders::GlSlEs100
}
} else if version.major >= 4 {
Shaders::GlSl400
} else if version.major >= 3 {
Shaders::GlSl130
} else {
if version.major >= 4 {
Shaders::GlSl400
} else if version.major >= 3 {
Shaders::GlSl130
} else {
Shaders::GlSl110
}
Shaders::GlSl110
}
};
@ -141,7 +139,7 @@ pub fn run<F: FnMut(&Ui) -> bool>(title: String, clear_color: [f32; 4], mut run_
break;
}
encoder.clear(&mut main_color, clear_color);
encoder.clear(&main_color, clear_color);
renderer.render(ui, &mut factory, &mut encoder).expect(
"Rendering failed",
);

View File

@ -432,7 +432,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) {
});
ui.tree_node(im_str!("Color/Picker Widgets")).build(|| {
let ref mut s = state.color_edit;
let s = &mut state.color_edit;
ui.checkbox(im_str!("With HDR"), &mut s.hdr);
ui.same_line(0.0);
show_help_marker(ui, im_str!("Currently all this does is to lift the 0..1 limits on dragging widgets."));
@ -531,7 +531,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) {
}
ui.same_line(0.0);
ui.text(match state.selected_fish {
Some(index) => names[index].clone(),
Some(index) => names[index],
None => im_str!("<None>"),
});
ui.popup(im_str!("select"), || {
@ -539,7 +539,7 @@ fn show_test_window<'a>(ui: &Ui<'a>, state: &mut State, opened: &mut bool) {
ui.separator();
for (index, name) in names.iter().enumerate() {
if ui.selectable(
name.clone(),
name,
false,
ImGuiSelectableFlags::empty(),
ImVec2::new(0.0, 0.0),

View File

@ -173,7 +173,7 @@ impl<R: Resources> Renderer<R> {
];
ui.render(|ui, draw_list| {
self.render_draw_list(ui, factory, encoder, draw_list)
self.render_draw_list(ui, factory, encoder, &draw_list)
})
}
fn render_draw_list<'a, F: Factory<R>, C: CommandBuffer<R>>(
@ -181,7 +181,7 @@ impl<R: Resources> Renderer<R> {
ui: &'a Ui<'a>,
factory: &mut F,
encoder: &mut Encoder<R, C>,
draw_list: DrawList<'a>,
draw_list: &DrawList<'a>,
) -> RendererResult<()> {
let (scale_width, scale_height) = ui.imgui().display_framebuffer_scale();

View File

@ -66,7 +66,7 @@ impl Renderer {
pub fn init<F: Facade>(imgui: &mut ImGui, ctx: &F) -> RendererResult<Renderer> {
let device_objects = try!(DeviceObjects::init(imgui, ctx));
Ok(Renderer {
ctx: ctx.get_context().clone(),
ctx: Rc::clone(ctx.get_context()),
device_objects: device_objects,
})
}
@ -74,7 +74,7 @@ impl Renderer {
pub fn render<'a, S: Surface>(&mut self, surface: &mut S, ui: Ui<'a>) -> RendererResult<()> {
let _ = self.ctx.insert_debug_marker("imgui-rs: starting rendering");
let result = ui.render(|ui, draw_list| {
self.render_draw_list(surface, ui, draw_list)
self.render_draw_list(surface, ui, &draw_list)
});
let _ = self.ctx.insert_debug_marker("imgui-rs: rendering finished");
result
@ -84,7 +84,7 @@ impl Renderer {
&mut self,
surface: &mut S,
ui: &'a Ui<'a>,
draw_list: DrawList<'a>,
draw_list: &DrawList<'a>,
) -> RendererResult<()> {
use glium::{Blend, DrawParameters, Rect};
use glium::uniforms::{MinifySamplerFilter, MagnifySamplerFilter};

View File

@ -184,7 +184,7 @@ bitflags!(
/// Window flags
#[repr(C)]
pub struct ImGuiWindowFlags: c_int {
const NoTitleBar = 1 << 0;
const NoTitleBar = 1;
const NoResize = 1 << 1;
const NoMove = 1 << 2;
const NoScrollbar = 1 << 3;
@ -273,7 +273,7 @@ bitflags!(
/// Condition flags
#[repr(C)]
pub struct ImGuiCond: c_int {
const Always = 1 << 0;
const Always = 1;
const Once = 1 << 1;
const FirstUseEver = 1 << 2;
const Appearing = 1 << 3;
@ -296,7 +296,7 @@ bitflags!(
#[repr(C)]
pub struct ImGuiColumnsFlags: c_int {
/// Disable column dividers
const NoBorder = 1 << 0;
const NoBorder = 1;
/// Disable resizing columns when clicking on the dividers
const NoResize = 1 << 1;
/// Disable column width preservation when adjusting columns
@ -310,7 +310,7 @@ bitflags!(
/// Flags for text inputs
#[repr(C)]
pub struct ImGuiInputTextFlags: c_int {
const CharsDecimal = 1 << 0;
const CharsDecimal = 1;
const CharsHexadecimal = 1 << 1;
const CharsUppercase = 1 << 2;
const CharsNoBlank = 1 << 3;
@ -383,7 +383,7 @@ bitflags!(
/// Flags for selectables
#[repr(C)]
pub struct ImGuiSelectableFlags: c_int {
const DontClosePopups = 1 << 0;
const DontClosePopups = 1;
const SpanAllColumns = 1 << 1;
const AllowDoubleClick = 1 << 2;
}
@ -403,7 +403,7 @@ bitflags!(
/// Flags for trees and collapsing headers
#[repr(C)]
pub struct ImGuiTreeNodeFlags: c_int {
const Selected = 1 << 0;
const Selected = 1;
const Framed = 1 << 1;
const AllowOverlapMode = 1 << 2;
const NoTreePushOnOpen = 1 << 3;