Run cargo fmt
This commit is contained in:
parent
0722d5e3ec
commit
983aa1b366
|
@ -213,7 +213,10 @@ impl Pokemon {
|
|||
}
|
||||
|
||||
async fn fetch_image(id: u16) -> Result<image::Handle, reqwest::Error> {
|
||||
let url = format!("https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{}.png", id);
|
||||
let url = format!(
|
||||
"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{}.png",
|
||||
id
|
||||
);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Sandbox for Styling {
|
|||
match message {
|
||||
Message::ThemeChanged(theme) => self.theme = theme,
|
||||
Message::InputChanged(value) => self.input_value = value,
|
||||
Message::ButtonPressed => (),
|
||||
Message::ButtonPressed => {}
|
||||
Message::SliderChanged(value) => self.slider_value = value,
|
||||
Message::CheckboxToggled(value) => self.toggle_value = value,
|
||||
}
|
||||
|
|
|
@ -78,7 +78,8 @@ where
|
|||
.drain(..)
|
||||
.map(|recipe| {
|
||||
Box::new(With::new(recipe, value.clone()))
|
||||
as Box<dyn Recipe<H, E, Output = (T, O)>>
|
||||
as
|
||||
Box<dyn Recipe<H, E, Output = (T, O)>>
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
|
|
|
@ -209,10 +209,11 @@ where
|
|||
cursor_position: Point,
|
||||
messages: &mut Vec<Message>,
|
||||
) {
|
||||
let mut clicked_region =
|
||||
self.elements.iter().zip(layout.children()).filter(
|
||||
|(_, layout)| layout.bounds().contains(cursor_position),
|
||||
);
|
||||
let mut clicked_region = self
|
||||
.elements
|
||||
.iter()
|
||||
.zip(layout.children())
|
||||
.filter(|(_, layout)| layout.bounds().contains(cursor_position));
|
||||
|
||||
if let Some(((pane, content), layout)) = clicked_region.next() {
|
||||
if let Some(on_click) = &self.on_click {
|
||||
|
|
|
@ -113,7 +113,7 @@ impl Cursor {
|
|||
State::Selection { start, end } if end > 0 => {
|
||||
self.select_range(start, end - 1)
|
||||
}
|
||||
_ => (),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ impl Cursor {
|
|||
State::Selection { start, end } if end < value.len() => {
|
||||
self.select_range(start, end + 1)
|
||||
}
|
||||
_ => (),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ impl<'a> Editor<'a> {
|
|||
self.cursor.move_left(self.value);
|
||||
self.value.remove_many(left, right);
|
||||
}
|
||||
_ => (),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
self.value.insert(self.cursor.end(self.value), character);
|
||||
|
@ -35,7 +35,7 @@ impl<'a> Editor<'a> {
|
|||
self.cursor.move_left(self.value);
|
||||
self.value.remove_many(left, right);
|
||||
}
|
||||
_ => (),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
self.value.insert_many(self.cursor.end(self.value), content);
|
||||
|
|
|
@ -97,23 +97,25 @@ impl fmt::Display for Error {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::InvalidData { byte_count } => {
|
||||
write!(f,
|
||||
"The provided RGBA data (with length {:?}) isn't divisble by \
|
||||
write!(
|
||||
f,
|
||||
"The provided RGBA data (with length {:?}) isn't divisble by \
|
||||
4. Therefore, it cannot be safely interpreted as 32bpp RGBA \
|
||||
pixels.",
|
||||
byte_count,
|
||||
)
|
||||
byte_count,
|
||||
)
|
||||
}
|
||||
Error::DimensionsMismatch {
|
||||
width,
|
||||
height,
|
||||
pixel_count,
|
||||
} => {
|
||||
write!(f,
|
||||
"The number of RGBA pixels ({:?}) does not match the provided \
|
||||
write!(
|
||||
f,
|
||||
"The number of RGBA pixels ({:?}) does not match the provided \
|
||||
dimensions ({:?}x{:?}).",
|
||||
pixel_count, width, height,
|
||||
)
|
||||
pixel_count, width, height,
|
||||
)
|
||||
}
|
||||
Error::OsError(e) => write!(
|
||||
f,
|
||||
|
|
|
@ -134,11 +134,14 @@ impl Pipeline {
|
|||
bind_group_layouts: &[&constant_layout, &texture_layout],
|
||||
});
|
||||
|
||||
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some("iced_wgpu::image::shader"),
|
||||
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!("shader/image.wgsl"))),
|
||||
flags: wgpu::ShaderFlags::all()
|
||||
});
|
||||
let shader =
|
||||
device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some("iced_wgpu::image::shader"),
|
||||
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(
|
||||
include_str!("shader/image.wgsl"),
|
||||
)),
|
||||
flags: wgpu::ShaderFlags::all(),
|
||||
});
|
||||
|
||||
let pipeline =
|
||||
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
|
@ -422,16 +425,14 @@ impl Pipeline {
|
|||
let mut render_pass =
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("iced_wgpu::image render pass"),
|
||||
color_attachments: &[
|
||||
wgpu::RenderPassColorAttachment {
|
||||
view: target,
|
||||
resolve_target: None,
|
||||
ops: wgpu::Operations {
|
||||
load: wgpu::LoadOp::Load,
|
||||
store: true,
|
||||
},
|
||||
color_attachments: &[wgpu::RenderPassColorAttachment {
|
||||
view: target,
|
||||
resolve_target: None,
|
||||
ops: wgpu::Operations {
|
||||
load: wgpu::LoadOp::Load,
|
||||
store: true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
depth_stencil_attachment: None,
|
||||
});
|
||||
|
||||
|
|
|
@ -119,5 +119,5 @@ fn fs_main(
|
|||
input.border_radius + 0.5,
|
||||
dist);
|
||||
|
||||
return vec4<f32>(radius_alpha, radius_alpha, radius_alpha, radius_alpha);
|
||||
return vec4<f32>(mixed_color.x, mixed_color.y, mixed_color.z, mixed_color.w * radius_alpha);
|
||||
}
|
||||
|
|
|
@ -74,11 +74,14 @@ impl Blit {
|
|||
bind_group_layouts: &[&constant_layout, &texture_layout],
|
||||
});
|
||||
|
||||
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some("iced_wgpu::triangle::blit_shader"),
|
||||
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!("../shader/blit.wgsl"))),
|
||||
flags: wgpu::ShaderFlags::all()
|
||||
});
|
||||
let shader =
|
||||
device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some("iced_wgpu::triangle::blit_shader"),
|
||||
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(
|
||||
include_str!("../shader/blit.wgsl"),
|
||||
)),
|
||||
flags: wgpu::ShaderFlags::all(),
|
||||
});
|
||||
|
||||
let pipeline =
|
||||
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
|
@ -176,16 +179,14 @@ impl Blit {
|
|||
let mut render_pass =
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("iced_wgpu::triangle::msaa render pass"),
|
||||
color_attachments: &[
|
||||
wgpu::RenderPassColorAttachment {
|
||||
view: target,
|
||||
resolve_target: None,
|
||||
ops: wgpu::Operations {
|
||||
load: wgpu::LoadOp::Load,
|
||||
store: true,
|
||||
},
|
||||
color_attachments: &[wgpu::RenderPassColorAttachment {
|
||||
view: target,
|
||||
resolve_target: None,
|
||||
ops: wgpu::Operations {
|
||||
load: wgpu::LoadOp::Load,
|
||||
store: true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
depth_stencil_attachment: None,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue