Skip to content

Commit

Permalink
fix(coap): address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Dec 20, 2024
1 parent 446e10d commit ab5e06d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lib/coapcore/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait Scope: Sized + core::fmt::Debug + defmt::Format {
}

impl Scope for core::convert::Infallible {
fn request_is_allowed<M: ReadableMessage>(&self, request: &M) -> bool {
fn request_is_allowed<M: ReadableMessage>(&self, _request: &M) -> bool {
match *self {}
}
}
Expand All @@ -36,7 +36,7 @@ pub trait ScopeGenerator: Sized {
impl ScopeGenerator for core::convert::Infallible {
type Scope = core::convert::Infallible;

fn from_token_scope(self, bytes: &[u8]) -> Result<Self::Scope, InvalidScope> {
fn from_token_scope(self, _bytes: &[u8]) -> Result<Self::Scope, InvalidScope> {
match self {}
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ impl<S: Scope + From<AifValue>> ScopeGenerator for ParsingAif<S> {
.array_iter::<(&str, u32)>()
.map_err(|_| InvalidScope)?
{
let (path, mask) = item.map_err(|_| InvalidScope)?;
let (path, _mask) = item.map_err(|_| InvalidScope)?;
if !path.starts_with("/") {
return Err(InvalidScope);
}
Expand Down
10 changes: 9 additions & 1 deletion src/lib/coapcore/src/seccfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ pub trait ServerSecurityConfig: crate::Sealed {

/// Expands an EDHOC `ID_CRED_x` into a parsed `CRED_x` along with the associated
/// authorizations.
#[allow(
unused_variables,
reason = "Names are human visible part of API description"
)]
fn expand_id_cred_x(
&self,
id_cred_x: lakers::IdCred,
Expand All @@ -84,6 +88,10 @@ pub trait ServerSecurityConfig: crate::Sealed {
///
/// The default (or any error) renderer produces a generic 4.01 Unauthorized in the handler;
/// specifics can be useful in ACE scenarios to return a Request Creation Hint.
#[allow(
unused_variables,
reason = "Names are human visible part of API description"
)]
fn render_not_allowed<M: coap_message::MutableWritableMessage>(
&self,
message: &mut M,
Expand Down Expand Up @@ -115,7 +123,7 @@ pub enum NullGenerator<Scope> {
impl<Scope: crate::scope::Scope> crate::scope::ScopeGenerator for NullGenerator<Scope> {
type Scope = Scope;

fn from_token_scope(self, bytes: &[u8]) -> Result<Self::Scope, crate::scope::InvalidScope> {
fn from_token_scope(self, _bytes: &[u8]) -> Result<Self::Scope, crate::scope::InvalidScope> {
match self {
NullGenerator::_Phantom(infallible, _) => match infallible {},
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/coapcore/src/seccontext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl<
c_r,
c_i,
},
authorization: original_authorization, // So far, this is self.nosec_authorization()
.. // Discarding original authorization
} = sec_context_state
{
#[allow(clippy::indexing_slicing, reason = "slice fits by construction")]
Expand Down

0 comments on commit ab5e06d

Please sign in to comment.