Skip to content

Commit a3d321d

Browse files
committed
Remove combine_control_expr
1 parent 01085b8 commit a3d321d

File tree

4 files changed

+65
-20
lines changed

4 files changed

+65
-20
lines changed

.rustfmt.toml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ max_width = 90 # changed
22
normalize_comments = true # changed
33
imports_layout = "Vertical" # changed
44
imports_granularity = "Crate" # changed
5-
combine_control_expr = false # changed
65
trailing_semicolon = false # changed
76
edition = "2021" # changed
87
use_try_shorthand = true # changed

fuel-core/src/service/metrics.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use axum::response::IntoResponse;
22
#[cfg(feature = "metrics")]
33
use fuel_metrics::core_metrics::encode_metrics_response;
4-
use hyper::{Body, Request};
4+
use hyper::{
5+
Body,
6+
Request,
7+
};
58

69
pub async fn metrics(_req: Request<Body>) -> impl IntoResponse {
710
#[cfg(feature = "metrics")]

fuel-core/src/state/rocks_db.rs

+38-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
1-
use crate::state::KVItem;
21
use crate::{
32
database::{
43
columns,
54
columns::METADATA,
6-
metadata::{DB_VERSION, DB_VERSION_KEY},
5+
metadata::{
6+
DB_VERSION,
7+
DB_VERSION_KEY,
8+
},
79
},
810
state::{
9-
BatchOperations, ColumnId, Error, IterDirection, KeyValueStore, TransactableStorage,
11+
BatchOperations,
12+
ColumnId,
13+
Error,
14+
IterDirection,
15+
KVItem,
16+
KeyValueStore,
17+
TransactableStorage,
1018
WriteOperation,
1119
},
1220
};
1321
#[cfg(feature = "metrics")]
1422
use fuel_metrics::core_metrics::DATABASE_METRICS;
1523
use rocksdb::{
16-
BoundColumnFamily, ColumnFamilyDescriptor, DBCompressionType, DBWithThreadMode, IteratorMode,
17-
MultiThreaded, Options, ReadOptions, SliceTransform, WriteBatch,
24+
BoundColumnFamily,
25+
ColumnFamilyDescriptor,
26+
DBCompressionType,
27+
DBWithThreadMode,
28+
IteratorMode,
29+
MultiThreaded,
30+
Options,
31+
ReadOptions,
32+
SliceTransform,
33+
WriteBatch,
34+
};
35+
use std::{
36+
convert::TryFrom,
37+
path::Path,
38+
sync::Arc,
1839
};
19-
use std::{convert::TryFrom, path::Path, sync::Arc};
2040

2141
type DB = DBWithThreadMode<MultiThreaded>;
2242
#[derive(Debug)]
@@ -66,11 +86,11 @@ impl RocksDb {
6686
)?;
6787
}
6888
Some(v) => {
69-
let b =
70-
<[u8; 4]>::try_from(v.as_slice()).map_err(|_| Error::InvalidDatabaseVersion)?;
89+
let b = <[u8; 4]>::try_from(v.as_slice())
90+
.map_err(|_| Error::InvalidDatabaseVersion)?;
7191
let version = u32::from_be_bytes(b);
7292
if version != DB_VERSION {
73-
return Err(Error::InvalidDatabaseVersion);
93+
return Err(Error::InvalidDatabaseVersion)
7494
}
7595
}
7696
};
@@ -144,7 +164,11 @@ impl KeyValueStore for RocksDb {
144164
.map(|_| prev)
145165
}
146166

147-
fn delete(&self, key: &[u8], column: ColumnId) -> crate::state::Result<Option<Vec<u8>>> {
167+
fn delete(
168+
&self,
169+
key: &[u8],
170+
column: ColumnId,
171+
) -> crate::state::Result<Option<Vec<u8>>> {
148172
let prev = self.get(key, column)?;
149173
self.db
150174
.delete_cf(&self.cf(column), key)
@@ -228,7 +252,10 @@ impl KeyValueStore for RocksDb {
228252
}
229253

230254
impl BatchOperations for RocksDb {
231-
fn batch_write(&self, entries: &mut dyn Iterator<Item = WriteOperation>) -> Result<(), Error> {
255+
fn batch_write(
256+
&self,
257+
entries: &mut dyn Iterator<Item = WriteOperation>,
258+
) -> Result<(), Error> {
232259
let mut batch = WriteBatch::default();
233260

234261
for entry in entries {

fuel-metrics/src/core_metrics.rs

+23-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
use axum::response::IntoResponse;
2-
use hyper::{header::CONTENT_TYPE, Body, Response};
2+
use hyper::{
3+
header::CONTENT_TYPE,
4+
Body,
5+
Response,
6+
};
37
use lazy_static::lazy_static;
4-
use prometheus::register_int_counter;
5-
use prometheus::{self, Encoder, IntCounter, TextEncoder};
8+
use prometheus::{
9+
self,
10+
register_int_counter,
11+
Encoder,
12+
IntCounter,
13+
TextEncoder,
14+
};
615

716
/// DatabaseMetrics is a wrapper struct for all
817
/// of the initialized counters for Database-related metrics
@@ -16,9 +25,13 @@ pub struct DatabaseMetrics {
1625

1726
lazy_static! {
1827
pub static ref DATABASE_METRICS: DatabaseMetrics = DatabaseMetrics {
19-
write_meter: register_int_counter!("Writes", "Number of database write operations")
28+
write_meter: register_int_counter!(
29+
"Writes",
30+
"Number of database write operations"
31+
)
32+
.unwrap(),
33+
read_meter: register_int_counter!("Reads", "Number of database read operations")
2034
.unwrap(),
21-
read_meter: register_int_counter!("Reads", "Number of database read operations").unwrap(),
2235
bytes_written_meter: register_int_counter!(
2336
"Bytes_Written",
2437
"The number of bytes written to the database"
@@ -43,8 +56,11 @@ pub struct CoreMetrics {
4356

4457
lazy_static! {
4558
pub static ref CORE_METRICS: CoreMetrics = CoreMetrics {
46-
blocks_processed: register_int_counter!("Blocks_Processed", "Number of blocks processed")
47-
.unwrap(),
59+
blocks_processed: register_int_counter!(
60+
"Blocks_Processed",
61+
"Number of blocks processed"
62+
)
63+
.unwrap(),
4864
transactions_executed: register_int_counter!(
4965
"Transactions_Processed",
5066
"Number of transactions executed"

0 commit comments

Comments
 (0)