clippy
This commit is contained in:
+1
-1
@@ -141,7 +141,7 @@ impl From<Float> for Inputs {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'csg> Interpreter<'csg> {
|
||||
impl Interpreter<'_> {
|
||||
fn pull<T: Pull + From<Inputs>>(&mut self, consider: Inputs) -> T {
|
||||
if consider == Inputs::Variable {
|
||||
T::pull(self)
|
||||
|
||||
+29
-36
@@ -596,7 +596,7 @@ impl ApplicationHandler for App {
|
||||
|
||||
// Create an egui GUI
|
||||
let gui = Gui::new_with_subpass(
|
||||
&event_loop,
|
||||
event_loop,
|
||||
surface.clone(),
|
||||
self.graphics_queue.clone(),
|
||||
Subpass::from(render_pass.clone(), 1).unwrap(),
|
||||
@@ -647,16 +647,13 @@ impl ApplicationHandler for App {
|
||||
_device_id: winit::event::DeviceId,
|
||||
event: DeviceEvent,
|
||||
) {
|
||||
match &event {
|
||||
DeviceEvent::MouseMotion { delta } => {
|
||||
if self.cstate.looking {
|
||||
self.cstate.forward.x -= delta.1 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||
self.cstate.forward.y += delta.0 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||
self.cstate.forward.x += 360f32 % 360f32;
|
||||
self.cstate.forward.y += 360f32 % 360f32;
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
if let DeviceEvent::MouseMotion { delta } = &event {
|
||||
if self.cstate.looking {
|
||||
self.cstate.forward.x -= delta.1 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||
self.cstate.forward.y += delta.0 as f32 * self.gstate.cursor_sensitivity * 0.3;
|
||||
self.cstate.forward.x += 360f32 % 360f32;
|
||||
self.cstate.forward.y += 360f32 % 360f32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,7 +1035,7 @@ impl App {
|
||||
let content = compute_result_buffer.read().unwrap();
|
||||
for (val, csg) in content.iter().zip(fake_csg.iter()) {
|
||||
println!("{val:?}");
|
||||
let expected = Interpreter::new(csg).scene(Vec3::ONE) as f32;
|
||||
let expected = Interpreter::new(csg).scene(Vec3::ONE);
|
||||
if expected != val.f[0] {
|
||||
println!("ERROR: expected {}, got {}", expected, val.f[0]);
|
||||
}
|
||||
@@ -1486,7 +1483,7 @@ impl PartialEq<InputTypes> for Inputs {
|
||||
fn gpu_buffer<T>(
|
||||
input: Vec<T>,
|
||||
allocator: Arc<StandardMemoryAllocator>,
|
||||
sub_allocator: Arc<SubbufferAllocator>,
|
||||
sub_allocator: &SubbufferAllocator,
|
||||
command_allocator: Arc<StandardCommandBufferAllocator>,
|
||||
transfer_queue: Arc<Queue>,
|
||||
) -> Subbuffer<[T]>
|
||||
@@ -1729,10 +1726,10 @@ fn object_size_dependent_setup(
|
||||
}
|
||||
} else {
|
||||
match *actual {
|
||||
Inputs::Float(f) => floats.push(f as f32),
|
||||
Inputs::Vec2(f) => vec2s.push(f.map(|x| x as f32).into()),
|
||||
Inputs::Vec3(f) => vec4s.push(f.map(|x| x as f32).extend(1.).into()),
|
||||
Inputs::Vec4(f) => vec4s.push(f.map(|x| x as f32).into()),
|
||||
Inputs::Float(f) => floats.push(f),
|
||||
Inputs::Vec2(f) => vec2s.push(f.map(|x| x).into()),
|
||||
Inputs::Vec3(f) => vec4s.push(f.map(|x| x).extend(1.).into()),
|
||||
Inputs::Vec4(f) => vec4s.push(f.map(|x| x).into()),
|
||||
Inputs::Mat2(f) => mat2s.push(f.to_cols_array_2d()),
|
||||
Inputs::Mat3(f) => mat3s.push(f.to_cols_array_2d()),
|
||||
Inputs::Mat4(f) => mat4s.push(f.to_cols_array_2d()),
|
||||
@@ -1835,41 +1832,37 @@ fn object_size_dependent_setup(
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let staging = Arc::new(SubbufferAllocator::new(
|
||||
allocator.clone(),
|
||||
SubbufferAllocatorCreateInfo {
|
||||
buffer_usage: BufferUsage::TRANSFER_SRC,
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_HOST
|
||||
| MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
let staging = SubbufferAllocator::new(allocator.clone(), SubbufferAllocatorCreateInfo {
|
||||
buffer_usage: BufferUsage::TRANSFER_SRC,
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_HOST | MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let csg_scene = gpu_buffer(
|
||||
scene,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_desc = gpu_buffer(
|
||||
desc,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_floats = gpu_buffer(
|
||||
floats,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_vec2s = gpu_buffer(
|
||||
vec2s,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
@@ -1878,42 +1871,42 @@ fn object_size_dependent_setup(
|
||||
let csg_vec4s = gpu_buffer(
|
||||
vec4s,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_mat2s = gpu_buffer(
|
||||
mat2s,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_mat3s = gpu_buffer(
|
||||
mat3s,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_mat4s = gpu_buffer(
|
||||
mat4s,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_mats = gpu_buffer(
|
||||
mats,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue.clone(),
|
||||
);
|
||||
let csg_deps = gpu_buffer(
|
||||
deps,
|
||||
allocator.clone(),
|
||||
staging.clone(),
|
||||
&staging,
|
||||
command_allocator.clone(),
|
||||
queue,
|
||||
);
|
||||
|
||||
+10
-10
@@ -97,12 +97,12 @@ fn get_char(mut s: Chars) -> Result<(char, usize)> {
|
||||
loop {
|
||||
let next = s.next().ok_or(Error::Eof);
|
||||
count += 1;
|
||||
if next.as_ref().map_or(false, |&c| c.is_whitespace()) {
|
||||
if next.as_ref().is_ok_and(|&c| c.is_whitespace()) {
|
||||
continue;
|
||||
}
|
||||
if next.as_ref().map_or(false, |this| this == &'/') {
|
||||
if s.next().map_or(false, |this| this == '/') {
|
||||
while s.next().map_or(false, |s| s != '\n' && s != '\r') {
|
||||
if next.as_ref().is_ok_and(|this| this == &'/') {
|
||||
if s.next() == Some('/') {
|
||||
while s.next().is_some_and(|s| s != '\n' && s != '\r') {
|
||||
count += 1;
|
||||
}
|
||||
count += 1;
|
||||
@@ -117,7 +117,7 @@ fn get_char(mut s: Chars) -> Result<(char, usize)> {
|
||||
// SERDE IS NOT A PARSING LIBRARY. This impl block defines a few basic parsing
|
||||
// functions from scratch. More complicated formats may wish to use a dedicated
|
||||
// parsing library to help implement their Serde deserializer.
|
||||
impl<'de> Deserializer<'de> {
|
||||
impl Deserializer<'_> {
|
||||
fn check_end(&mut self) -> bool {
|
||||
self.input.next_strict().is_none()
|
||||
}
|
||||
@@ -189,7 +189,7 @@ impl<'de> Deserializer<'de> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
|
||||
impl<'de> de::Deserializer<'de> for &mut Deserializer<'de> {
|
||||
type Error = Error;
|
||||
|
||||
forward_to_deserialize_any! {
|
||||
@@ -396,7 +396,7 @@ impl<'a, 'de> CommaSeparated<'a, 'de> {
|
||||
|
||||
// `SeqAccess` is provided to the `Visitor` to give it the ability to iterate
|
||||
// through elements of the sequence.
|
||||
impl<'de, 'a> SeqAccess<'de> for CommaSeparated<'a, 'de> {
|
||||
impl<'de> SeqAccess<'de> for CommaSeparated<'_, 'de> {
|
||||
type Error = Error;
|
||||
|
||||
fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>>
|
||||
@@ -414,7 +414,7 @@ impl<'de, 'a> SeqAccess<'de> for CommaSeparated<'a, 'de> {
|
||||
|
||||
// `MapAccess` is provided to the `Visitor` to give it the ability to iterate
|
||||
// through entries of the map.
|
||||
impl<'de, 'a> MapAccess<'de> for CommaSeparated<'a, 'de> {
|
||||
impl<'de> MapAccess<'de> for CommaSeparated<'_, 'de> {
|
||||
type Error = Error;
|
||||
|
||||
fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>>
|
||||
@@ -459,7 +459,7 @@ impl<'a, 'de> Enum<'a, 'de> {
|
||||
//
|
||||
// Note that all enum deserialization methods in Serde refer exclusively to the
|
||||
// "externally tagged" enum representation.
|
||||
impl<'de, 'a> EnumAccess<'de> for Enum<'a, 'de> {
|
||||
impl<'de> EnumAccess<'de> for Enum<'_, 'de> {
|
||||
type Error = Error;
|
||||
type Variant = Self;
|
||||
|
||||
@@ -482,7 +482,7 @@ impl<'de, 'a> EnumAccess<'de> for Enum<'a, 'de> {
|
||||
|
||||
// `VariantAccess` is provided to the `Visitor` to give it the ability to see
|
||||
// the content of the single variant that it decided to deserialize.
|
||||
impl<'de, 'a> VariantAccess<'de> for Enum<'a, 'de> {
|
||||
impl<'de> VariantAccess<'de> for Enum<'_, 'de> {
|
||||
type Error = Error;
|
||||
|
||||
// If the `Visitor` expected this variant to be a unit variant, the input
|
||||
|
||||
+2
-3
@@ -309,7 +309,7 @@ fn get_half(o: &HashMap<String, String>) -> Result<Half, String> {
|
||||
if half as usize >= mem::variant_count::<Half>() {
|
||||
return Err("invalid enum".to_owned());
|
||||
}
|
||||
unsafe { mem::transmute(half) }
|
||||
unsafe { mem::transmute::<u8, Half>(half) }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -323,8 +323,7 @@ pub(crate) fn load_csg(
|
||||
|
||||
mcsg.object
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(_i, o)| {
|
||||
.map(|o| {
|
||||
let name = name.clone() + "_" + o.get("name").unwrap_or(&"unknown".to_owned());
|
||||
let _trs = get_trs(o)?;
|
||||
let _color = get_color(o)?;
|
||||
|
||||
Reference in New Issue
Block a user