Skip to content

Commit ce9c7e4

Browse files
committed
refactor(server_core): 🚨 Fix lints and fail CI on clippy warnings
1 parent f69b428 commit ce9c7e4

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

alvr/graphics/src/stream.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ impl StreamRenderer {
224224
}
225225
}
226226

227+
/// # Safety
228+
/// `hardware_buffer` must be a valid pointer to a ANativeWindowBuffer.
227229
pub unsafe fn render(&self, hardware_buffer: *mut c_void, view_params: [StreamViewParams; 2]) {
228230
// if hardware_buffer is available copy stream to staging texture
229231
if !hardware_buffer.is_null() {

alvr/server_core/src/connection.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ pub fn handshake_loop(ctx: Arc<ConnectionContext>, lifecycle_state: Arc<RwLock<L
312312
}
313313
};
314314

315-
if let WiredConnectionStatus::NotReady(m) = status {
316-
dbg_connection!("handshake_loop: Wired connection not ready: {m}");
315+
#[cfg_attr(not(debug_assertions), allow(unused_variables))]
316+
if let WiredConnectionStatus::NotReady(s) = status {
317+
dbg_connection!("handshake_loop: Wired connection not ready: {s}");
317318
thread::sleep(RETRY_CONNECT_MIN_INTERVAL);
318319
continue;
319320
}

alvr/xtask/src/ci.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,20 @@ pub fn clippy_ci() {
4444
let stream = Deserializer::from_slice(&out.stdout).into_iter::<Value>();
4545

4646
// https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages
47-
for message in stream.filter_map(|msg| {
48-
let msg = msg.unwrap();
47+
let messages = stream
48+
.filter_map(|msg| {
49+
let msg = msg.unwrap();
4950

50-
if msg.get("reason")? == "compiler-message" {
51-
msg.get("message").map(|x| x.to_owned())
52-
} else {
53-
None
54-
}
55-
}) {
56-
let msg: CompilerMessage = json::from_value(message).unwrap();
51+
if msg.get("reason")? == "compiler-message" {
52+
msg.get("message").map(|x| x.to_owned())
53+
} else {
54+
None
55+
}
56+
})
57+
.collect::<Vec<_>>();
58+
59+
for message in &messages {
60+
let msg: CompilerMessage = json::from_value(message.clone()).unwrap();
5761

5862
if msg.message_type != "diagnostic" {
5963
continue;
@@ -100,4 +104,8 @@ pub fn clippy_ci() {
100104
if !out.status.success() {
101105
panic!("ci clippy didn't exit with 0 code, propagating failure");
102106
}
107+
108+
if !messages.is_empty() {
109+
panic!("ci clippy produced warnings");
110+
}
103111
}

0 commit comments

Comments
 (0)