Skip to content

Commit e2071b5

Browse files
committed
Simplify code
1 parent bae9d95 commit e2071b5

File tree

1 file changed

+4
-6
lines changed
  • opentelemetry-sdk/src/export/logs

1 file changed

+4
-6
lines changed

opentelemetry-sdk/src/export/logs/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ pub struct LogBatch<'a> {
2323

2424
/// The `LogBatchData` enum represents the data field of a `LogBatch`.
2525
/// It can either be:
26-
/// - A shared reference to a vector of tuples, where each tuple consists of a `LogRecord` and an `InstrumentationScope`.
27-
/// - Or it can be a slice of tuples, where each tuple consists of a reference to a `LogRecord` and a reference to an `InstrumentationScope`.
26+
/// - A shared reference to a slice of tuples, where each tuple consists of an owned `LogRecord` and an owned `InstrumentationScope`.
27+
/// - Or it can be a shared reference to a slice of tuples, where each tuple consists of a reference to a `LogRecord` and a reference to an `InstrumentationScope`.
2828
#[derive(Debug)]
29-
#[allow(clippy::vec_box)] // Clippy complains about using Box in a Vec, but it's done here for performant moves of the data between channel and the vec.
3029
enum LogBatchData<'a> {
31-
BorrowedVec(&'a Vec<Box<(LogRecord, InstrumentationScope)>>), // Used by BatchProcessor which clones the LogRecords for its own use.
30+
BorrowedVec(&'a [Box<(LogRecord, InstrumentationScope)>]), // Used by BatchProcessor which clones the LogRecords for its own use.
3231
BorrowedSlice(&'a [(&'a LogRecord, &'a InstrumentationScope)]),
3332
}
3433

@@ -53,9 +52,8 @@ impl<'a> LogBatch<'a> {
5352
}
5453
}
5554

56-
#[allow(clippy::vec_box)] // Clippy complains about using Box in a Vec, but it's done here for performant moves of the data between channel and the vec.
5755
pub(crate) fn new_with_owned_data(
58-
data: &'a Vec<Box<(LogRecord, InstrumentationScope)>>,
56+
data: &'a [Box<(LogRecord, InstrumentationScope)>],
5957
) -> LogBatch<'a> {
6058
LogBatch {
6159
data: LogBatchData::BorrowedVec(data),

0 commit comments

Comments
 (0)