fix: clippy
This commit is contained in:
@@ -59,7 +59,7 @@ impl Alias {
|
||||
|
||||
fn add_to(new_node: &Arc<Node>, original: &Arc<Node>, info: AliasInfo) -> Result<()> {
|
||||
let alias = Alias {
|
||||
node: Arc::downgrade(&new_node),
|
||||
node: Arc::downgrade(new_node),
|
||||
original: Arc::downgrade(original),
|
||||
info,
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ pub fn mask_matches(mask_map_lesser: &Datamap, mask_map_greater: &Datamap) -> bo
|
||||
let greater_key = get_mask(mask_map_greater)?.index(key)?;
|
||||
// otherwise zero-length vectors don't count the same as a single type vector
|
||||
if lesser_key.flexbuffer_type().is_heterogenous_vector()
|
||||
&& lesser_key.as_vector().len() == 0
|
||||
&& lesser_key.as_vector().is_empty()
|
||||
&& greater_key.flexbuffer_type().is_vector()
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -76,7 +76,7 @@ impl Lines {
|
||||
thickness: (first.thickness + last.thickness) * 0.5,
|
||||
color: color.into(),
|
||||
};
|
||||
points.push_front(connect_point.clone());
|
||||
points.push_front(connect_point);
|
||||
points.push_back(connect_point);
|
||||
}
|
||||
stereokit_rust::system::Lines::add_list(token, points.make_contiguous());
|
||||
|
||||
@@ -26,12 +26,12 @@ pub fn draw(token: &MainThreadToken) {
|
||||
text::draw_all(token);
|
||||
|
||||
if let Some(skytex) = QUEUED_SKYTEX.lock().take() {
|
||||
if let Ok(skytex) = SHCubemap::from_cubemap_equirectangular(&skytex, true, 100) {
|
||||
if let Ok(skytex) = SHCubemap::from_cubemap_equirectangular(skytex, true, 100) {
|
||||
Renderer::skytex(skytex.tex);
|
||||
}
|
||||
}
|
||||
if let Some(skylight) = QUEUED_SKYLIGHT.lock().take() {
|
||||
if let Ok(skylight) = SHCubemap::from_cubemap_equirectangular(&skylight, true, 100) {
|
||||
if let Ok(skylight) = SHCubemap::from_cubemap_equirectangular(skylight, true, 100) {
|
||||
Renderer::skylight(skylight.sh);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ impl MaterialParameter {
|
||||
}
|
||||
MaterialParameter::Texture(resource) => {
|
||||
let Some(texture_path) =
|
||||
get_resource_file(&resource, &client, &[OsStr::new("png"), OsStr::new("jpg")])
|
||||
get_resource_file(resource, client, &[OsStr::new("png"), OsStr::new("jpg")])
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -3,8 +3,7 @@ use smithay::backend::renderer::gles::{
|
||||
ffi::{self, Gles2, FRAGMENT_SHADER, VERTEX_SHADER},
|
||||
GlesError,
|
||||
};
|
||||
use std::mem::transmute;
|
||||
use stereokit_rust::shader::Shader;
|
||||
use stereokit_rust::shader::{Shader, _ShaderT};
|
||||
use tracing::error;
|
||||
|
||||
// Simula shader with fancy lanzcos sampling
|
||||
@@ -133,7 +132,7 @@ pub unsafe fn shader_inject(
|
||||
let gl_frag = compile_shader(c, FRAGMENT_SHADER, frag_str)?;
|
||||
let gl_prog = link_program(c, gl_vert, gl_frag)?;
|
||||
|
||||
let shader: *mut FfiShader = transmute(sk_shader.0.as_mut());
|
||||
let shader = sk_shader.0.as_mut() as *mut _ShaderT as *mut FfiShader;
|
||||
if let Some(shader) = shader.as_mut() {
|
||||
shader.shader.vertex = gl_vert;
|
||||
shader.shader.pixel = gl_frag;
|
||||
|
||||
@@ -46,7 +46,7 @@ impl Text {
|
||||
let text = TEXT_REGISTRY.add(Text {
|
||||
space: node.get_aspect::<Spatial>().unwrap().clone(),
|
||||
font_path: style.font.as_ref().and_then(|res| {
|
||||
get_resource_file(&res, &client, &[OsStr::new("ttf"), OsStr::new("otf")])
|
||||
get_resource_file(res, &client, &[OsStr::new("ttf"), OsStr::new("otf")])
|
||||
}),
|
||||
style: OnceCell::new(),
|
||||
|
||||
@@ -93,7 +93,7 @@ impl Text {
|
||||
super::TextFit::Exact => TextFit::Exact,
|
||||
super::TextFit::Overflow => TextFit::Overflow,
|
||||
},
|
||||
Some(style.clone()),
|
||||
Some(*style),
|
||||
Some(Color128::new(
|
||||
data.color.c.r,
|
||||
data.color.c.g,
|
||||
|
||||
@@ -54,7 +54,7 @@ impl BoxFieldAspect for BoxField {
|
||||
let Field::Box(this_field) = &*this_field else {
|
||||
return Ok(());
|
||||
};
|
||||
this_field.set_size(size.into());
|
||||
this_field.set_size(size);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,9 +161,7 @@ pub fn process_input() {
|
||||
// Iterate over the distance links and send input to them
|
||||
for (i, input_link) in input_links.into_iter().enumerate() {
|
||||
let handler = input_link.handler.spatial.node().unwrap();
|
||||
if !handler_input.contains_key(&handler.id) {
|
||||
handler_input.insert(handler.id, (handler.clone(), Vec::new(), Vec::new()));
|
||||
}
|
||||
handler_input.entry(handler.id).or_insert_with(|| (handler.clone(), Vec::new(), Vec::new()));
|
||||
let (_, methods, datas) = handler_input.get_mut(&handler.id).unwrap();
|
||||
|
||||
let method_alias = input_link
|
||||
|
||||
@@ -140,7 +140,7 @@ impl CameraItem {
|
||||
let sk_mat = self
|
||||
.sk_mat
|
||||
.get_or_try_init(|| -> Result<Arc<MaterialWrapper>> {
|
||||
let shader = Shader::from_memory(&UNLIT_SHADER_BYTES)?;
|
||||
let shader = Shader::from_memory(UNLIT_SHADER_BYTES)?;
|
||||
let mut mat = Material::new(&shader, None);
|
||||
mat.get_all_param_info().set_texture("diffuse", &sk_tex.0);
|
||||
mat.transparency(Transparency::Blend);
|
||||
|
||||
@@ -35,7 +35,7 @@ fn release(item: &Item) {
|
||||
*captured_acceptor = Weak::default();
|
||||
acceptor.handle_release(item);
|
||||
if let Some(ui) = item.type_info.ui.lock().upgrade() {
|
||||
ui.handle_release_item(item, &acceptor);
|
||||
ui.handle_release_item(item, acceptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ use stereokit_rust::maths::Bounds;
|
||||
|
||||
stardust_xr_server_codegen::codegen_spatial_protocol!();
|
||||
impl Transform {
|
||||
pub fn to_mat4(self, position: bool, rotation: bool, scale: bool) -> Mat4 {
|
||||
pub fn to_mat4(&self, position: bool, rotation: bool, scale: bool) -> Mat4 {
|
||||
let position = position
|
||||
.then_some(self.translation)
|
||||
.flatten()
|
||||
@@ -184,7 +184,7 @@ impl Spatial {
|
||||
}
|
||||
fn set_parent(self: &Arc<Self>, new_parent: Option<&Arc<Spatial>>) {
|
||||
if let Some(parent) = self.get_parent() {
|
||||
parent.children.remove(&self);
|
||||
parent.children.remove(self);
|
||||
}
|
||||
if let Some(new_parent) = &new_parent {
|
||||
new_parent.children.add_raw(self);
|
||||
@@ -218,7 +218,7 @@ impl Spatial {
|
||||
}
|
||||
|
||||
self.set_local_transform(Spatial::space_to_space_matrix(
|
||||
Some(&self),
|
||||
Some(self),
|
||||
parent.map(AsRef::as_ref),
|
||||
));
|
||||
self.set_parent(parent);
|
||||
|
||||
Reference in New Issue
Block a user