Clippy lints

This commit is contained in:
Henrik Tjäder 2021-12-25 13:17:16 +01:00
parent c78177c37e
commit c297b4ee8d
7 changed files with 16 additions and 8 deletions

View file

@ -107,7 +107,7 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 {
.map(|(_, monotonic)| { .map(|(_, monotonic)| {
let name = &monotonic.ident; let name = &monotonic.ident;
let name_str = &name.to_string(); let name_str = &name.to_string();
let ident = util::monotonic_ident(&name_str); let ident = util::monotonic_ident(name_str);
let doc = &format!( let doc = &format!(
"This module holds the static implementation for `{}::now()`", "This module holds the static implementation for `{}::now()`",
name_str name_str

View file

@ -51,7 +51,7 @@ pub fn codegen(
let expr = &task_local.expr; let expr = &task_local.expr;
let attrs = &task_local.attrs; let attrs = &task_local.attrs;
let mangled_name = util::declared_static_local_resource_ident(resource_name, &task_name); let mangled_name = util::declared_static_local_resource_ident(resource_name, task_name);
// For future use // For future use
// let doc = format!(" RTIC internal: {}:{}", file!(), line!()); // let doc = format!(" RTIC internal: {}:{}", file!(), line!());

View file

@ -21,7 +21,7 @@ pub fn codegen(
for (name, res) in &app.shared_resources { for (name, res) in &app.shared_resources {
let cfgs = &res.cfgs; let cfgs = &res.cfgs;
let ty = &res.ty; let ty = &res.ty;
let mangled_name = &util::static_shared_resource_ident(&name); let mangled_name = &util::static_shared_resource_ident(name);
// late resources in `util::link_section_uninit` // late resources in `util::link_section_uninit`
let section = util::link_section_uninit(); let section = util::link_section_uninit();

View file

@ -32,7 +32,7 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
None None
}; };
let ty = &res.ty; let ty = &res.ty;
let mangled_name = util::static_shared_resource_ident(&name); let mangled_name = util::static_shared_resource_ident(name);
let shared_name = util::need_to_lock_ident(name); let shared_name = util::need_to_lock_ident(name);
if !res.properties.lock_free { if !res.properties.lock_free {

View file

@ -76,7 +76,7 @@ pub fn interrupt_ident() -> Ident {
} }
pub fn timer_queue_marker_ident() -> Ident { pub fn timer_queue_marker_ident() -> Ident {
mark_internal_name(&"TIMER_QUEUE_MARKER") mark_internal_name("TIMER_QUEUE_MARKER")
} }
/// Whether `name` is an exception with configurable priority /// Whether `name` is an exception with configurable priority
@ -225,7 +225,7 @@ pub fn rq_ident(priority: u8) -> Ident {
/// Generates an identifier for the `enum` of `schedule`-able tasks /// Generates an identifier for the `enum` of `schedule`-able tasks
pub fn schedule_t_ident() -> Ident { pub fn schedule_t_ident() -> Ident {
Ident::new(&"SCHED_T", Span::call_site()) Ident::new("SCHED_T", Span::call_site())
} }
/// Generates an identifier for the `enum` of `spawn`-able tasks /// Generates an identifier for the `enum` of `spawn`-able tasks
@ -278,7 +278,7 @@ pub fn need_to_lock_ident(name: &Ident) -> Ident {
/// The name to get better RT flag errors /// The name to get better RT flag errors
pub fn rt_err_ident() -> Ident { pub fn rt_err_ident() -> Ident {
Ident::new( Ident::new(
&"you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml", "you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml",
Span::call_site(), Span::call_site(),
) )
} }

View file

@ -95,12 +95,20 @@ impl<T> RacyCell<T> {
} }
/// Get `*mut T` /// Get `*mut T`
///
/// # Safety
///
/// See documentation notes for [`RacyCell`]
#[inline(always)] #[inline(always)]
pub unsafe fn get_mut(&self) -> *mut T { pub unsafe fn get_mut(&self) -> *mut T {
self.0.get() self.0.get()
} }
/// Get `*const T` /// Get `*const T`
///
/// # Safety
///
/// See documentation notes for [`RacyCell`]
#[inline(always)] #[inline(always)]
pub unsafe fn get(&self) -> *const T { pub unsafe fn get(&self) -> *const T {
self.0.get() self.0.get()

View file

@ -176,6 +176,6 @@ where
Mono: Monotonic, Mono: Monotonic,
{ {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(&other)) Some(self.cmp(other))
} }
} }