Skip to content

Commit f0cc51c

Browse files
committed
Clippy
1 parent 433ab14 commit f0cc51c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

probe-plotter-tools/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ use shunting::{MathContext, RPNExpr, ShuntingParser};
88

99
fn main() {
1010
let elf_path = std::env::args()
11-
.skip(1)
12-
.next()
11+
.nth(1)
1312
.expect("Usage: \nprobe-plotter /path/to/elf chip");
1413

1514
let target = std::env::args()
16-
.skip(2)
17-
.next()
15+
.nth(2)
1816
.unwrap_or_else(|| "stm32g474retx".to_owned());
1917
let mut session = probe_rs::Session::auto_attach(target, Default::default()).unwrap();
2018
let mut core = session.core(0).unwrap();

probe-plotter/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ pub struct Metric<T> {
3131
/// This library currently uses the `shunting` library for parsing the expression for the formula.
3232
/// Check the documentation for that lib for the syntax to use.
3333
impl<T> Metric<T> {
34+
/// # Safety
35+
/// Internal use only by [make_metric]
3436
pub const unsafe fn new(x: *mut T) -> Self {
3537
Metric { x }
3638
}
3739

3840
pub fn set(&mut self, x: T) {
3941
unsafe {
4042
// TODO: Is volatile the right thing to use here?
41-
(self.x as *mut T).write_volatile(x);
43+
self.x.write_volatile(x);
4244
}
4345
}
4446

4547
pub fn get(&mut self) -> T {
46-
unsafe { (self.x as *mut T).read_volatile() }
48+
unsafe { self.x.read_volatile() }
4749
}
4850
}

0 commit comments

Comments
 (0)