Skip to content

Commit

Permalink
refactor: 🚨 Fix some clippy lints; update some dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Mar 22, 2024
1 parent b6f7560 commit d01478e
Show file tree
Hide file tree
Showing 13 changed files with 877 additions and 829 deletions.
1,646 changes: 845 additions & 801 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion alvr/audio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ pub fn record_audio_blocking(
config.sample_format(),
{
let state = Arc::clone(&state);
let is_running = is_running.clone();
let is_running = Arc::clone(&is_running);
move |data, _| {
let data = if config.sample_format() == SampleFormat::F32 {
data.bytes()
Expand Down
4 changes: 2 additions & 2 deletions alvr/client_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ app_dirs2 = "2"
bincode = "1"
glyph_brush_layout = "0.2"
jni = "0.21"
local-ip-address = "0.5"
local-ip-address = "0.6"
mdns-sd = "0.10"
rand = "0.8"
serde = "1"
Expand All @@ -40,7 +40,7 @@ ndk = { version = "0.8", features = [
] }
ndk-context = "0.1"
ndk-sys = "0.5"
oboe = "0.5" # todo: remove once AudioThread shutdown crash is fixed
oboe = "0.6" # todo: remove once AudioThread shutdown crash is fixed

[target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.11"
Expand Down
12 changes: 6 additions & 6 deletions alvr/client_core/src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ pub unsafe extern "C" fn alvr_try_get_permission(permission: *const c_char) {
}

/// NB: for android, `context` must be thread safe.
#[cfg(target_os = "android")]
#[no_mangle]
pub unsafe extern "C" fn alvr_initialize(
#[cfg(target_os = "android")] java_vm: *mut c_void,
#[cfg(target_os = "android")] context: *mut c_void,
capabilities: AlvrClientCapabilities,
) {
#[cfg(target_os = "android")]
pub unsafe extern "C" fn alvr_initialize_android_context(java_vm: *mut c_void, context: *mut c_void) {
ndk_context::initialize_android_context(java_vm, context);
}

/// On android, alvr_initialize_android_context() must be called first, then alvr_initialize().
#[no_mangle]
pub unsafe extern "C" fn alvr_initialize(capabilities: AlvrClientCapabilities) {
let default_view_resolution = UVec2::new(
capabilities.default_view_width,
capabilities.default_view_height,
Expand Down
12 changes: 5 additions & 7 deletions alvr/client_openxr/src/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,16 @@ pub fn initialize_interaction(
)
.unwrap();

let combined_eyes_source = if face_tracking_sources
let combined_eyes_source = (face_tracking_sources
.as_ref()
.map(|s| s.combined_eye_gaze)
.unwrap_or(false)
&& xr_ctx.instance.exts().ext_eye_gaze_interaction.is_some()
&& xr_ctx
.instance
.supports_eye_gaze_interaction(xr_ctx.system)
.unwrap()
{
.unwrap())
.then(|| {
let action = action_set
.create_action("combined_eye_gaze", "Combined eye gaze", &[])
.unwrap();
Expand All @@ -204,10 +204,8 @@ pub fn initialize_interaction(
.create_space(xr_ctx.session.clone(), xr::Path::NULL, xr::Posef::IDENTITY)
.unwrap();

Some((action, space))
} else {
None
};
(action, space)
});

xr_ctx.session.attach_action_sets(&[&action_set]).unwrap();

Expand Down
4 changes: 3 additions & 1 deletion alvr/client_openxr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ pub fn entry_point() {
)
.unwrap();
}
_ => panic!(),
ClientCoreEvent::DecoderConfig { .. } | ClientCoreEvent::FrameReady { .. } => {
panic!()
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions alvr/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enable-messagebox = ["rfd"]
[dependencies]
anyhow = { version = "1", features = ["backtrace"] }
backtrace = "0.3"
glam = { version = "0.25", features = ["serde"] }
glam = { version = "0.26", features = ["serde"] }
log = "0.4"
once_cell = "1"
parking_lot = "0.12"
Expand All @@ -23,4 +23,4 @@ settings-schema = { git = "https://github.com/alvr-org/settings-schema-rs", rev
# settings-schema = { path = "../../../../settings-schema-rs/settings-schema" }

[target.'cfg(not(target_os = "android"))'.dependencies]
rfd = { version = "0.13", optional = true }
rfd = { version = "0.14", optional = true }
2 changes: 1 addition & 1 deletion alvr/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ureq = { version = "2", features = ["json"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
ewebsock = "0.4"
ewebsock = "0.5"
futures = "0.3"
gloo-net = "0.5"
instant = { version = "0.1", features = ["wasm-bindgen"] }
Expand Down
2 changes: 1 addition & 1 deletion alvr/launcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ anyhow = "1"
eframe = "0.26"
futures-util = "0.3.28"
open = "5"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "stream", "json"] }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream", "json"] }
serde_json = "1"
tokio = { version = "1", features = ["rt-multi-thread"] }
zip = "0.6"
2 changes: 1 addition & 1 deletion alvr/server_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ alvr_session.workspace = true
cpal = { version = "0.15", features = ["jack"] }
encoding_rs_io = "0.1"
dirs = "5"
runas = "=1.0"
runas = "^1.2" # version 1.1 is broken
serde_json = "1"
2 changes: 1 addition & 1 deletion alvr/server_io/src/openvrpaths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub(crate) fn to_openvr_paths(paths: &[PathBuf]) -> json::Value {
fn get_single_openvr_path(path_type: &str) -> Result<PathBuf> {
let openvr_paths_json = load_openvr_paths_json()?;
let paths_json = openvr_paths_json.get(path_type).to_any()?;
from_openvr_paths(paths_json).get(0).cloned().to_any()
from_openvr_paths(paths_json).first().cloned().to_any()
}

pub fn steamvr_root_dir() -> Result<PathBuf> {
Expand Down
12 changes: 7 additions & 5 deletions alvr/session/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ fn main() {
.captures_iter(&openvr_driver_header_string)
.map(|cap| {
let code = cap[3].into();
let mut name = cap[1].replace('_', "");
if code == "1007" {
name = "HardwareRevisionString".into();
let name = if code == "1007" {
"HardwareRevisionString".into()
} else if code == "1017" {
name = "HardwareRevisionUint64".into();
}
"HardwareRevisionUint64".into()
} else {
cap[1].replace('_', "")
};

PropInfo {
name,
ty: cap[2].into(),
Expand Down
2 changes: 2 additions & 0 deletions alvr/sockets/src/control_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ fn framed_recv<R: DeserializeOwned>(
break;
} else if Instant::now() > deadline {
return alvr_common::try_again();
} else {
continue;
}
}

Expand Down

0 comments on commit d01478e

Please sign in to comment.