Skip to content

Commit c649409

Browse files
committed
Fix all warnings for Rust 1.84.0
1 parent 10fee74 commit c649409

File tree

7 files changed

+72
-70
lines changed

7 files changed

+72
-70
lines changed

src/lib.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@
3232
//!
3333
//! Crate-level features include:
3434
//! - `parallel-runtime`: use Rayon to execute reactions in parallel
35-
//! when possible. This is not yet the default. For some applications,
36-
//! where there is no data parallelism, this may harm performance
37-
//! (as well as pull in unneeded dependencies) and should be off.
35+
//! when possible. This is not yet the default. For some applications,
36+
//! where there is no data parallelism, this may harm performance
37+
//! (as well as pull in unneeded dependencies) and should be off.
3838
//! - `wide-ids`: Enables 64-bit wide reaction ids on 64-bit
39-
//! architectures. This may reduce performance, but allows for
40-
//! 2^32 reactor instances compared to the default of 2^16,
41-
//! which may feel a bit tight for some applications. On machines
42-
//! with a pointer-width of less than 64 bits, ID types are
43-
//! always 32 bits. The feature also widens trigger ids to 64 bits
44-
//! if possible, which enables 2^64 individual trigger components
45-
//! (ports, actions, etc.) instead of 2^32.
39+
//! architectures. This may reduce performance, but allows for
40+
//! 2^32 reactor instances compared to the default of 2^16,
41+
//! which may feel a bit tight for some applications. On machines
42+
//! with a pointer-width of less than 64 bits, ID types are
43+
//! always 32 bits. The feature also widens trigger ids to 64 bits
44+
//! if possible, which enables 2^64 individual trigger components
45+
//! (ports, actions, etc.) instead of 2^32.
4646
//! - `vec-id-sets`: Change the implementation of reaction sets
47-
//! to be a sorted vector instead of a hash set. This has a positive
48-
//! performance impact, as reaction sets are typically very small.
49-
//! More testing is required to determine pathological cases.
50-
//! This is a default feature.
47+
//! to be a sorted vector instead of a hash set. This has a positive
48+
//! performance impact, as reaction sets are typically very small.
49+
//! More testing is required to determine pathological cases.
50+
//! This is a default feature.
5151
//! - `no-unsafe`: disable optimisations that use unsafe code in this runtime.
52-
//! Just provided for comparison, should probably be removed (unsafe code is fine).
52+
//! Just provided for comparison, should probably be removed (unsafe code is fine).
5353
5454
// #![deny(unused_crate_dependencies)]
5555
#![deny(unused_extern_crates)]
@@ -61,18 +61,16 @@
6161
#[macro_use]
6262
extern crate array_macro;
6363
#[cfg(test)]
64-
#[allow(unused)]
64+
#[allow(unused, unused_imports)]
6565
#[macro_use]
6666
extern crate assert_matches;
67-
#[macro_use]
68-
extern crate index_vec;
67+
// #[macro_use]
68+
// extern crate index_vec;
6969
#[macro_use]
7070
extern crate log;
7171
#[cfg(feature = "parallel-runtime")]
7272
extern crate rayon;
7373
#[macro_use]
74-
extern crate smallvec;
75-
#[macro_use]
7674
extern crate static_assertions;
7775
#[macro_use]
7876
extern crate cfg_if;

src/ports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ struct PortCell<T: Sync> {
304304
/// - say you have bound A -> B, then B -> C
305305
/// - so all three refer to the equiv class of A, whose downstream is now {B, C}
306306
/// - if you then try binding C -> A, then we can know
307-
/// that C is in the downstream of A, indicating that there is a cycle.
307+
/// that C is in the downstream of A, indicating that there is a cycle.
308308
downstreams: Downstreams<T>,
309309
}
310310

src/scheduler/assembly_impl.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ where
119119
}
120120

121121
/// Final result of the assembly of a reactor.
122-
pub struct FinishedReactor<'x, S>(AssemblyCtx<'x, S>, S)
122+
#[allow(unused_variables)]
123+
pub struct FinishedReactor<'x, S>(PhantomData<&'x mut u8>, S)
123124
where
124125
S: ReactorInitializer;
125126

@@ -148,8 +149,8 @@ where
148149
self,
149150
build_reactor_tree: impl FnOnce(Self) -> AssemblyResult<AssemblyIntermediate<'x, S>>,
150151
) -> AssemblyResult<FinishedReactor<'x, S>> {
151-
let AssemblyIntermediate(ich, reactor) = build_reactor_tree(self)?;
152-
Ok(FinishedReactor(ich, reactor))
152+
let AssemblyIntermediate(_, reactor) = build_reactor_tree(self)?;
153+
Ok(FinishedReactor(PhantomData, reactor))
153154
}
154155

155156
/// Innermost function.
@@ -263,7 +264,7 @@ where
263264
) -> AssemblyResult<AssemblyIntermediate<'x, S>>
264265
where
265266
Sub: ReactorInitializer + 'static,
266-
// we can't use impl Fn(...) because we want to specify explicit type parameters in the calle
267+
// we can't use impl Fn(...) because we want to specify explicit type parameters in the calle
267268
F: FnOnce(Self, &mut Vec<Sub>) -> AssemblyResult<AssemblyIntermediate<'x, S>>,
268269
A: Fn(/*bank_index:*/ usize) -> Sub::Params,
269270
{
@@ -367,8 +368,8 @@ impl<S: ReactorInitializer> DependencyDeclarator<'_, '_, S> {
367368
#[inline]
368369
pub fn bind_ports_zip<'a, T: Sync + 'a>(
369370
&mut self,
370-
upstream: impl Iterator<Item = &'a mut Port<T>>,
371-
downstream: impl Iterator<Item = &'a mut Port<T>>,
371+
upstream: impl Iterator<Item=&'a mut Port<T>>,
372+
downstream: impl Iterator<Item=&'a mut Port<T>>,
372373
) -> AssemblyResult<()> {
373374
for (upstream, downstream) in upstream.zip(downstream) {
374375
self.bind_ports(upstream, downstream)?;
@@ -379,8 +380,8 @@ impl<S: ReactorInitializer> DependencyDeclarator<'_, '_, S> {
379380
#[inline]
380381
pub fn bind_ports_iterated<'a, T: Sync + 'a>(
381382
&mut self,
382-
upstream: impl Iterator<Item = &'a mut Port<T>>,
383-
mut downstream: impl Iterator<Item = &'a mut Port<T>>,
383+
upstream: impl Iterator<Item=&'a mut Port<T>>,
384+
mut downstream: impl Iterator<Item=&'a mut Port<T>>,
384385
) -> AssemblyResult<()> {
385386
let mut upstream = upstream.collect::<Vec<_>>();
386387
assert!(!upstream.is_empty(), "Empty upstream!");

src/scheduler/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::*;
1616
/// allows mutating the event queue of the scheduler.
1717
/// Only the interactions declared at assembly time
1818
/// are allowed.
19-
19+
///
2020
// Implementation details:
2121
// ReactionCtx is an API built around a ReactionWave. A single
2222
// ReactionCtx may be used for multiple ReactionWaves, but

src/scheduler/dependencies.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub(super) struct DepGraph {
109109
/// - port/action -> reaction: the port/action triggers the reaction
110110
/// - port -> port: a binding of a port to another
111111
/// - reaction n -> reaction m: means n has higher priority
112-
/// than m, only filled in for reactions of the same reactor.
112+
/// than m, only filled in for reactions of the same reactor.
113113
dataflow: DepGraphImpl,
114114

115115
/// Maps global IDs back to graph indices.
@@ -342,7 +342,7 @@ enum EdgeWeight {
342342
/// if they're labeled `Default`, they're trigger dependencies,
343343
/// otherwise use dependencies.
344344
Default,
345-
///
345+
/// See [Default].
346346
Use,
347347
}
348348

@@ -604,7 +604,7 @@ impl<'x> ExecutableReactions<'x> {
604604
}
605605

606606
#[inline]
607-
pub fn next_batch<'a>(&'a self, min_level_exclusive: KeyRef<&LevelIx>) -> Option<(KeyRef<&'a LevelIx>, &Level)> {
607+
pub fn next_batch<'a>(&'a self, min_level_exclusive: KeyRef<&LevelIx>) -> Option<(KeyRef<&'a LevelIx>, &'a Level)> {
608608
self.levels
609609
.next_mapping(min_level_exclusive)
610610
.map(|(ix, cow)| (ix, cow.as_ref()))

src/scheduler/scheduler_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ impl<'x> SyncScheduler<'x> {
169169
/// internals are not copied).
170170
/// So long as the framework entirely controls the lifetime
171171
/// of SyncScheduler instances, this is enforceable.
172+
#[allow(non_local_definitions)]
172173
unsafe impl Send for SyncScheduler<'_> {}
173174

174175
// install makes calls to parallel iterators use that thread pool

src/util/mod.rs

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,6 @@ pub(crate) fn do_write<X>(
6464
write!(f, "{}", suffix)
6565
}
6666

67-
/// Shorthand for using [After](crate::Offset::After) together with [delay].
68-
///
69-
/// ```
70-
/// use std::time::Duration;
71-
/// use reactor_rt::{after, Offset::After};
72-
///
73-
/// assert_eq!(after!(10 ns), After(Duration::from_nanos(10)));
74-
/// assert_eq!(after!(2 min), After(Duration::from_secs(120)));
75-
/// ```
76-
#[macro_export]
77-
macro_rules! after {
78-
($amount:tt $unit:tt) => { $crate::Offset::After($crate::delay!($amount $unit)) }
79-
}
8067

8168
/// Creates a [Duration] value using the same syntax as in LF.
8269
///
@@ -133,6 +120,45 @@ macro_rules! delay {
133120
($amount:tt $i:ident) => { compile_error!(concat!("Unknown time unit `", stringify!($i), "`")) };
134121
}
135122

123+
/// Shorthand for using [After](crate::Offset::After) together with [delay].
124+
///
125+
/// ```
126+
/// use std::time::Duration;
127+
/// use reactor_rt::{after, Offset::After};
128+
///
129+
/// assert_eq!(after!(10 ns), After(Duration::from_nanos(10)));
130+
/// assert_eq!(after!(2 min), After(Duration::from_secs(120)));
131+
/// ```
132+
#[macro_export]
133+
macro_rules! after {
134+
($amount:tt $unit:tt) => { $crate::Offset::After($crate::delay!($amount $unit)) }
135+
}
136+
137+
/// Convenient macro to [create a tag](crate::EventTag).
138+
/// This is just a shorthand for using the constructor together
139+
/// with the syntax of [delay].
140+
///
141+
/// ```no_run
142+
/// use reactor_rt::{tag, delay};
143+
///
144+
/// tag!(T0 + 20 ms);
145+
/// tag!(T0 + 60 ms);
146+
/// tag!(T0); // the origin tag
147+
/// // with a microstep:
148+
/// tag!(T0, 1);
149+
/// tag!(T0 + 3 sec, 1);
150+
/// ```
151+
#[macro_export]
152+
macro_rules! tag {
153+
(T0) => {$crate::EventTag::ORIGIN};
154+
(T0, $microstep:expr) => {tag!(T0 + 0 sec, $microstep)};
155+
(T0 + $amount:tt $unit:ident) => {tag!(T0 + $amount $unit, 0)};
156+
(T0 + $amount:tt $unit:ident, $microstep:expr) => {
157+
$crate::EventTag::offset($crate::delay!($amount $unit), $microstep)
158+
};
159+
}
160+
161+
136162
/// Convenient macro to assert equality of the current tag.
137163
/// This is just shorthand for using `assert_eq!` with the
138164
/// syntax of [tag].
@@ -164,30 +190,6 @@ macro_rules! assert_tag_is {
164190
};
165191
}
166192

167-
/// Convenient macro to [create a tag](crate::EventTag).
168-
/// This is just a shorthand for using the constructor together
169-
/// with the syntax of [delay].
170-
///
171-
/// ```no_run
172-
/// use reactor_rt::{tag, delay};
173-
///
174-
/// tag!(T0 + 20 ms);
175-
/// tag!(T0 + 60 ms);
176-
/// tag!(T0); // the origin tag
177-
/// // with a microstep:
178-
/// tag!(T0, 1);
179-
/// tag!(T0 + 3 sec, 1);
180-
/// ```
181-
#[macro_export]
182-
macro_rules! tag {
183-
(T0) => {$crate::EventTag::ORIGIN};
184-
(T0, $microstep:expr) => {tag!(T0 + 0 sec, $microstep)};
185-
(T0 + $amount:tt $unit:ident) => {tag!(T0 + $amount $unit, 0)};
186-
(T0 + $amount:tt $unit:ident, $microstep:expr) => {
187-
$crate::EventTag::offset($crate::delay!($amount $unit), $microstep)
188-
};
189-
}
190-
191193
/// A unit of time, used in LF.
192194
#[derive(Debug)]
193195
pub enum TimeUnit {

0 commit comments

Comments
 (0)