mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-23 15:02:26 +00:00
Fix formatting after clippy fixes.
This commit is contained in:
parent
4612f84045
commit
85cd5e0b80
@ -717,9 +717,18 @@ impl CayenneLpp {
|
||||
};
|
||||
|
||||
if let Some(prost_types::value::Kind::StructValue(s)) = &v.kind {
|
||||
let x = s.fields.get("x").ok_or_else(|| anyhow!("x field is missing"))?;
|
||||
let y = s.fields.get("y").ok_or_else(|| anyhow!("y field is missing"))?;
|
||||
let z = s.fields.get("z").ok_or_else(|| anyhow!("z field is missing"))?;
|
||||
let x = s
|
||||
.fields
|
||||
.get("x")
|
||||
.ok_or_else(|| anyhow!("x field is missing"))?;
|
||||
let y = s
|
||||
.fields
|
||||
.get("y")
|
||||
.ok_or_else(|| anyhow!("y field is missing"))?;
|
||||
let z = s
|
||||
.fields
|
||||
.get("z")
|
||||
.ok_or_else(|| anyhow!("z field is missing"))?;
|
||||
|
||||
if let Some(prost_types::value::Kind::NumberValue(v)) = &x.kind {
|
||||
item.x = *v;
|
||||
@ -789,9 +798,18 @@ impl CayenneLpp {
|
||||
};
|
||||
|
||||
if let Some(prost_types::value::Kind::StructValue(s)) = &v.kind {
|
||||
let x = s.fields.get("x").ok_or_else(|| anyhow!("x field is missing"))?;
|
||||
let y = s.fields.get("y").ok_or_else(|| anyhow!("y field is missing"))?;
|
||||
let z = s.fields.get("z").ok_or_else(|| anyhow!("z field is missing"))?;
|
||||
let x = s
|
||||
.fields
|
||||
.get("x")
|
||||
.ok_or_else(|| anyhow!("x field is missing"))?;
|
||||
let y = s
|
||||
.fields
|
||||
.get("y")
|
||||
.ok_or_else(|| anyhow!("y field is missing"))?;
|
||||
let z = s
|
||||
.fields
|
||||
.get("z")
|
||||
.ok_or_else(|| anyhow!("z field is missing"))?;
|
||||
|
||||
if let Some(prost_types::value::Kind::NumberValue(v)) = &x.kind {
|
||||
item.x = *v;
|
||||
|
@ -68,7 +68,9 @@ impl Integration {
|
||||
let client = aws_sdk_sns::Client::new(&config);
|
||||
|
||||
Ok(Integration {
|
||||
json: match Encoding::from_i32(conf.encoding).ok_or_else(|| anyhow!("Invalid encoding"))? {
|
||||
json: match Encoding::from_i32(conf.encoding)
|
||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
||||
{
|
||||
Encoding::Json => true,
|
||||
Encoding::Protobuf => false,
|
||||
},
|
||||
|
@ -32,7 +32,9 @@ impl Integration {
|
||||
|
||||
Ok(Integration {
|
||||
timeout: Duration::from_secs(5),
|
||||
json: match Encoding::from_i32(conf.encoding).ok_or_else(|| anyhow!("Invalid encoding"))? {
|
||||
json: match Encoding::from_i32(conf.encoding)
|
||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
||||
{
|
||||
Encoding::Json => true,
|
||||
Encoding::Protobuf => false,
|
||||
},
|
||||
|
@ -48,7 +48,9 @@ impl Integration {
|
||||
let auth_manager = AuthenticationManager::from(service_account);
|
||||
|
||||
Ok(Integration {
|
||||
json: match Encoding::from_i32(conf.encoding).ok_or_else(|| anyhow!("Invalid encoding"))? {
|
||||
json: match Encoding::from_i32(conf.encoding)
|
||||
.ok_or_else(|| anyhow!("Invalid encoding"))?
|
||||
{
|
||||
Encoding::Json => true,
|
||||
Encoding::Protobuf => false,
|
||||
},
|
||||
|
@ -38,7 +38,8 @@ impl Integration {
|
||||
Ok(Integration {
|
||||
timeout: Duration::from_secs(5),
|
||||
endpoint: conf.endpoint.clone(),
|
||||
version: InfluxDbVersion::from_i32(conf.version).ok_or_else(|| anyhow!("Invalid version"))?,
|
||||
version: InfluxDbVersion::from_i32(conf.version)
|
||||
.ok_or_else(|| anyhow!("Invalid version"))?,
|
||||
db: conf.db.clone(),
|
||||
username: conf.username.clone(),
|
||||
password: conf.password.clone(),
|
||||
|
@ -23,7 +23,9 @@ pub async fn handle(
|
||||
dev: &device::Device,
|
||||
block: &lrwn::MACCommandSet,
|
||||
) -> Result<Option<lrwn::MACCommandSet>> {
|
||||
let mac = (&**block).first().ok_or_else(|| anyhow!("Expected DevStatusAns"))?;
|
||||
let mac = (&**block)
|
||||
.first()
|
||||
.ok_or_else(|| anyhow!("Expected DevStatusAns"))?;
|
||||
if let lrwn::MACCommand::DevStatusAns(pl) = mac {
|
||||
info!(dev_eui = %dev.dev_eui, battery = pl.battery, margin = pl.margin, "DevStatusAns received");
|
||||
|
||||
|
@ -11,7 +11,9 @@ pub fn handle(
|
||||
dev: &device::Device,
|
||||
block: &lrwn::MACCommandSet,
|
||||
) -> Result<Option<lrwn::MACCommandSet>> {
|
||||
let _ = (&**block).first().ok_or_else(|| anyhow!("Expected LinkCheckReq"));
|
||||
let _ = (&**block)
|
||||
.first()
|
||||
.ok_or_else(|| anyhow!("Expected LinkCheckReq"));
|
||||
|
||||
info!(dev_eui = %dev.dev_eui, "Received LinkCheckReq");
|
||||
|
||||
|
@ -23,16 +23,18 @@ pub fn handle(
|
||||
let block_macs = &**block;
|
||||
let pending_macs = &**pending.unwrap();
|
||||
|
||||
let req_pl = if let lrwn::MACCommand::PingSlotChannelReq(pl) =
|
||||
pending_macs.first().ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||
let req_pl = if let lrwn::MACCommand::PingSlotChannelReq(pl) = pending_macs
|
||||
.first()
|
||||
.ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||
{
|
||||
pl
|
||||
} else {
|
||||
return Err(anyhow!("Expected PingSlotChannelReq"));
|
||||
};
|
||||
|
||||
let ans_pl = if let lrwn::MACCommand::PingSlotChannelAns(pl) =
|
||||
block_macs.first().ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||
let ans_pl = if let lrwn::MACCommand::PingSlotChannelAns(pl) = block_macs
|
||||
.first()
|
||||
.ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||
{
|
||||
pl
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user