mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy: fix warnings in various modules in components (#31568)
* clippy: fix warnings in various modules in components * fix: unit tests * fix: build on android * fix: all samplers use new_boxed
This commit is contained in:
parent
19f1f2a8f4
commit
3a5ca785d3
24 changed files with 107 additions and 118 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
use std::ptr;
|
||||
|
||||
use backtrace;
|
||||
use msg::constellation_msg::{HangProfile, HangProfileSymbol};
|
||||
|
||||
const MAX_NATIVE_FRAMES: usize = 1024;
|
||||
|
@ -18,7 +17,7 @@ pub struct DummySampler;
|
|||
|
||||
impl DummySampler {
|
||||
#[allow(dead_code)]
|
||||
pub fn new() -> Box<dyn Sampler> {
|
||||
pub fn new_boxed() -> Box<dyn Sampler> {
|
||||
Box::new(DummySampler)
|
||||
}
|
||||
}
|
||||
|
@ -64,12 +63,12 @@ impl NativeStack {
|
|||
instruction_ptr: *mut std::ffi::c_void,
|
||||
stack_ptr: *mut std::ffi::c_void,
|
||||
) -> Result<(), ()> {
|
||||
if !(self.count < MAX_NATIVE_FRAMES) {
|
||||
if self.count >= MAX_NATIVE_FRAMES {
|
||||
return Err(());
|
||||
}
|
||||
self.instruction_ptrs[self.count] = instruction_ptr;
|
||||
self.stack_ptrs[self.count] = stack_ptr;
|
||||
self.count = self.count + 1;
|
||||
self.count += 1;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -85,7 +84,7 @@ impl NativeStack {
|
|||
// TODO: use the demangled or C++ demangled symbols if available.
|
||||
let name = symbol
|
||||
.name()
|
||||
.map(|n| String::from_utf8_lossy(&n.as_bytes()).to_string());
|
||||
.map(|n| String::from_utf8_lossy(n.as_bytes()).to_string());
|
||||
let filename = symbol.filename().map(|n| n.to_string_lossy().to_string());
|
||||
let lineno = symbol.lineno();
|
||||
profile.backtrace.push(HangProfileSymbol {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue