mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-05-08 11:58:25 +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 {
|
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 x = s
|
||||||
let y = s.fields.get("y").ok_or_else(|| anyhow!("y field is missing"))?;
|
.fields
|
||||||
let z = s.fields.get("z").ok_or_else(|| anyhow!("z field is missing"))?;
|
.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 {
|
if let Some(prost_types::value::Kind::NumberValue(v)) = &x.kind {
|
||||||
item.x = *v;
|
item.x = *v;
|
||||||
@ -789,9 +798,18 @@ impl CayenneLpp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(prost_types::value::Kind::StructValue(s)) = &v.kind {
|
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 x = s
|
||||||
let y = s.fields.get("y").ok_or_else(|| anyhow!("y field is missing"))?;
|
.fields
|
||||||
let z = s.fields.get("z").ok_or_else(|| anyhow!("z field is missing"))?;
|
.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 {
|
if let Some(prost_types::value::Kind::NumberValue(v)) = &x.kind {
|
||||||
item.x = *v;
|
item.x = *v;
|
||||||
|
@ -68,7 +68,9 @@ impl Integration {
|
|||||||
let client = aws_sdk_sns::Client::new(&config);
|
let client = aws_sdk_sns::Client::new(&config);
|
||||||
|
|
||||||
Ok(Integration {
|
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::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,9 @@ impl Integration {
|
|||||||
|
|
||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
timeout: Duration::from_secs(5),
|
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::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
},
|
},
|
||||||
|
@ -48,7 +48,9 @@ impl Integration {
|
|||||||
let auth_manager = AuthenticationManager::from(service_account);
|
let auth_manager = AuthenticationManager::from(service_account);
|
||||||
|
|
||||||
Ok(Integration {
|
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::Json => true,
|
||||||
Encoding::Protobuf => false,
|
Encoding::Protobuf => false,
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,8 @@ impl Integration {
|
|||||||
Ok(Integration {
|
Ok(Integration {
|
||||||
timeout: Duration::from_secs(5),
|
timeout: Duration::from_secs(5),
|
||||||
endpoint: conf.endpoint.clone(),
|
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(),
|
db: conf.db.clone(),
|
||||||
username: conf.username.clone(),
|
username: conf.username.clone(),
|
||||||
password: conf.password.clone(),
|
password: conf.password.clone(),
|
||||||
|
@ -23,7 +23,9 @@ pub async fn handle(
|
|||||||
dev: &device::Device,
|
dev: &device::Device,
|
||||||
block: &lrwn::MACCommandSet,
|
block: &lrwn::MACCommandSet,
|
||||||
) -> Result<Option<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 {
|
if let lrwn::MACCommand::DevStatusAns(pl) = mac {
|
||||||
info!(dev_eui = %dev.dev_eui, battery = pl.battery, margin = pl.margin, "DevStatusAns received");
|
info!(dev_eui = %dev.dev_eui, battery = pl.battery, margin = pl.margin, "DevStatusAns received");
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ pub fn handle(
|
|||||||
dev: &device::Device,
|
dev: &device::Device,
|
||||||
block: &lrwn::MACCommandSet,
|
block: &lrwn::MACCommandSet,
|
||||||
) -> Result<Option<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");
|
info!(dev_eui = %dev.dev_eui, "Received LinkCheckReq");
|
||||||
|
|
||||||
|
@ -23,16 +23,18 @@ pub fn handle(
|
|||||||
let block_macs = &**block;
|
let block_macs = &**block;
|
||||||
let pending_macs = &**pending.unwrap();
|
let pending_macs = &**pending.unwrap();
|
||||||
|
|
||||||
let req_pl = if let lrwn::MACCommand::PingSlotChannelReq(pl) =
|
let req_pl = if let lrwn::MACCommand::PingSlotChannelReq(pl) = pending_macs
|
||||||
pending_macs.first().ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
.first()
|
||||||
|
.ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||||
{
|
{
|
||||||
pl
|
pl
|
||||||
} else {
|
} else {
|
||||||
return Err(anyhow!("Expected PingSlotChannelReq"));
|
return Err(anyhow!("Expected PingSlotChannelReq"));
|
||||||
};
|
};
|
||||||
|
|
||||||
let ans_pl = if let lrwn::MACCommand::PingSlotChannelAns(pl) =
|
let ans_pl = if let lrwn::MACCommand::PingSlotChannelAns(pl) = block_macs
|
||||||
block_macs.first().ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
.first()
|
||||||
|
.ok_or_else(|| anyhow!("Empty MACCommandSet"))?
|
||||||
{
|
{
|
||||||
pl
|
pl
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user