Skip to content

Commit

Permalink
Use semicolons more when nothing is returned.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Nov 2, 2023
1 parent 7a2271d commit 8363c62
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion crates/encoding/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ mod tests {
fn test_f32_to_f16_simple() {
let input: f32 = std::f32::consts::PI;
let output: u16 = f32_to_f16(input);
assert_eq!(0x4248u16, output) // 3.141
assert_eq!(0x4248u16, output); // 3.141
}

#[test]
Expand Down
12 changes: 6 additions & 6 deletions crates/encoding/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ impl<'a> PathEncoder<'a> {
PathEl::MoveTo(p0) => self.move_to(p0.x as f32, p0.y as f32),
PathEl::LineTo(p0) => self.line_to(p0.x as f32, p0.y as f32),
PathEl::QuadTo(p0, p1) => {
self.quad_to(p0.x as f32, p0.y as f32, p1.x as f32, p1.y as f32)
self.quad_to(p0.x as f32, p0.y as f32, p1.x as f32, p1.y as f32);
}
PathEl::CurveTo(p0, p1, p2) => self.cubic_to(
p0.x as f32,
Expand Down Expand Up @@ -608,23 +608,23 @@ impl<'a> PathEncoder<'a> {
#[cfg(feature = "full")]
impl fello::scale::Pen for PathEncoder<'_> {
fn move_to(&mut self, x: f32, y: f32) {
self.move_to(x, y)
self.move_to(x, y);
}

fn line_to(&mut self, x: f32, y: f32) {
self.line_to(x, y)
self.line_to(x, y);
}

fn quad_to(&mut self, cx0: f32, cy0: f32, x: f32, y: f32) {
self.quad_to(cx0, cy0, x, y)
self.quad_to(cx0, cy0, x, y);
}

fn curve_to(&mut self, cx0: f32, cy0: f32, cx1: f32, cy1: f32, x: f32, y: f32) {
self.cubic_to(cx0, cy0, cx1, cy1, x, y)
self.cubic_to(cx0, cy0, cx1, cy1, x, y);
}

fn close(&mut self) {
self.close()
self.close();
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/shaders/src/compile/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn preprocess(
eprintln!(
"Second else for same ifdef/ifndef (line {line_number}); \
ignoring second else"
)
);
} else {
item.else_passed = true;
item.active = !item.active;
Expand Down
2 changes: 1 addition & 1 deletion examples/scenes/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Download {
"{index}: Downloading {} from {}",
download.name, download.url
);
download.fetch(&self.directory, self.size_limit)?
download.fetch(&self.directory, self.size_limit)?;
}
println!("{} downloads complete", to_download.len());
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions examples/scenes/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn scene_from_files_inner(
if let Some(extension) = Path::new(&entry.file_name()).extension() {
if extension == "svg" {
count += 1;
scenes.push(example_scene_of(entry.path()))
scenes.push(example_scene_of(entry.path()));
}
}
}
Expand All @@ -63,7 +63,7 @@ fn scene_from_files_inner(
empty_dir();
}
} else {
scenes.push(example_scene_of(path.to_owned()))
scenes.push(example_scene_of(path.to_owned()));
}
}
Ok(SceneSet { scenes })
Expand Down Expand Up @@ -147,7 +147,7 @@ pub fn svg_function_of<R: AsRef<str>>(
Result::Ok((scene_frag, resolution)) => {
builder.append(&scene_frag, None);
params.resolution = Some(resolution);
cached_scene = Some((scene_frag, resolution))
cached_scene = Some((scene_frag, resolution));
}
Err(RecvTimeoutError::Timeout) => params.text.add(
builder,
Expand Down
2 changes: 1 addition & 1 deletion examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ fn labyrinth(sb: &mut SceneBuilder, _: &mut SceneParams) {
Color::rgba8(0x70, 0x80, 0x80, 0xff),
None,
&path,
)
);
}

fn robust_paths(sb: &mut SceneBuilder, _: &mut SceneParams) {
Expand Down
4 changes: 2 additions & 2 deletions examples/with_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn run(
profile_result,
) {
Ok(()) => {
println!("Wrote trace to path {path:?}")
println!("Wrote trace to path {path:?}");
}
Err(e) => eprintln!("Failed to write trace {e}"),
}
Expand Down Expand Up @@ -415,7 +415,7 @@ fn run(
width as f64,
height as f64,
profiling_result,
)
);
}
}
let surface_texture = render_state
Expand Down
10 changes: 5 additions & 5 deletions integrations/vello_svg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub use usvg;
///
/// See the [module level documentation](crate#unsupported-features) for a list of some unsupported svg features
pub fn render_tree(sb: &mut SceneBuilder, svg: &usvg::Tree) {
render_tree_with(sb, svg, default_error_handler).unwrap_or_else(|e| match e {})
render_tree_with(sb, svg, default_error_handler).unwrap_or_else(|e| match e {});
}

/// Append a [`usvg::Tree`] into a Vello [`SceneBuilder`].
Expand Down Expand Up @@ -81,13 +81,13 @@ pub fn render_tree_with<F: FnMut(&mut SceneBuilder, &usvg::Node) -> Result<(), E
local_path.move_to(most_recent_initial);
}
most_recent_initial = (x, y);
local_path.move_to(most_recent_initial)
local_path.move_to(most_recent_initial);
}
usvg::PathSegment::LineTo { x, y } => {
if std::mem::take(&mut just_closed) {
local_path.move_to(most_recent_initial);
}
local_path.line_to((x, y))
local_path.line_to((x, y));
}
usvg::PathSegment::CurveTo {
x1,
Expand All @@ -100,11 +100,11 @@ pub fn render_tree_with<F: FnMut(&mut SceneBuilder, &usvg::Node) -> Result<(), E
if std::mem::take(&mut just_closed) {
local_path.move_to(most_recent_initial);
}
local_path.curve_to((x1, y1), (x2, y2), (x, y))
local_path.curve_to((x1, y1), (x2, y2), (x, y));
}
usvg::PathSegment::ClosePath => {
just_closed = true;
local_path.close_path()
local_path.close_path();
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,27 @@ struct BezPathPen(peniko::kurbo::BezPath);

impl Pen for BezPathPen {
fn move_to(&mut self, x: f32, y: f32) {
self.0.move_to((x as f64, y as f64))
self.0.move_to((x as f64, y as f64));
}

fn line_to(&mut self, x: f32, y: f32) {
self.0.line_to((x as f64, y as f64))
self.0.line_to((x as f64, y as f64));
}

fn quad_to(&mut self, cx0: f32, cy0: f32, x: f32, y: f32) {
self.0
.quad_to((cx0 as f64, cy0 as f64), (x as f64, y as f64))
.quad_to((cx0 as f64, cy0 as f64), (x as f64, y as f64));
}

fn curve_to(&mut self, cx0: f32, cy0: f32, cx1: f32, cy1: f32, x: f32, y: f32) {
self.0.curve_to(
(cx0 as f64, cy0 as f64),
(cx1 as f64, cy1 as f64),
(x as f64, y as f64),
)
);
}

fn close(&mut self) {
self.0.close_path()
self.0.close_path();
}
}
2 changes: 1 addition & 1 deletion src/shaders/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn preprocess(input: &str, defines: &HashSet<String>, imports: &HashMap<&str
let item = stack.last_mut();
if let Some(item) = item {
if item.else_passed {
eprintln!("Second else for same ifdef/ifndef (line {line_number}); ignoring second else")
eprintln!("Second else for same ifdef/ifndef (line {line_number}); ignoring second else");
} else {
item.else_passed = true;
item.active = !item.active;
Expand Down
4 changes: 2 additions & 2 deletions src/wgpu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl WgpuEngine {
},
);
self.bind_map
.insert_image(image_proxy.id, texture, texture_view)
.insert_image(image_proxy.id, texture, texture_view);
}
Command::WriteImage(proxy, [x, y, width, height], data) => {
if let Ok((texture, _)) = self.bind_map.get_or_create_image(*proxy, device) {
Expand Down Expand Up @@ -755,7 +755,7 @@ impl<'a> TransientBindMap<'a> {
});
}
Entry::Occupied(mut o) => {
o.get_mut().upload_if_needed(proxy, device, queue, pool)
o.get_mut().upload_if_needed(proxy, device, queue, pool);
}
}
}
Expand Down

0 comments on commit 8363c62

Please sign in to comment.