Skip to content

Commit 626b4bb

Browse files
committed
fix clippy warnings
1 parent efb063c commit 626b4bb

10 files changed

Lines changed: 21 additions & 29 deletions

File tree

iceberg-rust-spec/src/spec/materialized_view_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub type MaterializedViewMetadata = GeneralViewMetadata<FullIdentifier>;
2929
pub type MaterializedViewMetadataBuilder = GeneralViewMetadataBuilder<FullIdentifier>;
3030

3131
impl MaterializedViewMetadata {
32-
pub fn as_ref(&self) -> TabularMetadataRef {
32+
pub fn as_ref(&self) -> TabularMetadataRef<'_> {
3333
TabularMetadataRef::MaterializedView(self)
3434
}
3535
}

iceberg-rust-spec/src/spec/table_metadata.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl TableMetadata {
204204
pub fn current_partition_fields(
205205
&self,
206206
branch: Option<&str>,
207-
) -> Result<Vec<BoundPartitionField>, Error> {
207+
) -> Result<Vec<BoundPartitionField<'_>>, Error> {
208208
let schema = self.current_schema(branch)?;
209209
let partition_spec = self.default_partition_spec()?;
210210
partition_fields(partition_spec, schema)
@@ -218,7 +218,10 @@ impl TableMetadata {
218218
/// # Returns
219219
/// * `Result<Vec<BoundPartitionField>, Error>` - Vector of partition fields bound to their source schema fields,
220220
/// or an error if the schema or partition spec cannot be found
221-
pub fn partition_fields(&self, snapshot_id: i64) -> Result<Vec<BoundPartitionField>, Error> {
221+
pub fn partition_fields(
222+
&self,
223+
snapshot_id: i64,
224+
) -> Result<Vec<BoundPartitionField<'_>>, Error> {
222225
let schema = self.schema(snapshot_id)?;
223226
self.default_partition_spec()?
224227
.fields()
@@ -325,7 +328,7 @@ impl TableMetadata {
325328
.map(|x| *x.sequence_number())
326329
}
327330

328-
pub fn as_ref(&self) -> TabularMetadataRef {
331+
pub fn as_ref(&self) -> TabularMetadataRef<'_> {
329332
TabularMetadataRef::Table(self)
330333
}
331334
}

iceberg-rust-spec/src/spec/view_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<T: Materialization> GeneralViewMetadata<T> {
143143
}
144144

145145
impl ViewMetadata {
146-
pub fn as_ref(&self) -> TabularMetadataRef {
146+
pub fn as_ref(&self) -> TabularMetadataRef<'_> {
147147
TabularMetadataRef::View(self)
148148
}
149149
}

iceberg-rust/src/file_format/parquet.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ pub fn parquet_to_datafile(
258258
}
259259

260260
let content = builder
261-
.build()
262-
.map_err(iceberg_rust_spec::error::Error::from)?;
261+
.build()?;
263262
Ok(content)
264263
}
265264

iceberg-rust/src/materialized_view/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl MaterializedView {
152152
///
153153
/// # Returns
154154
/// A new transaction that can be used to perform multiple operations atomically
155-
pub fn new_transaction(&mut self, branch: Option<&str>) -> MaterializedViewTransaction {
155+
pub fn new_transaction(&mut self, branch: Option<&str>) -> MaterializedViewTransaction<'_> {
156156
MaterializedViewTransaction::new(self, branch)
157157
}
158158
/// Returns the storage table that contains the materialized data for this view

iceberg-rust/src/object_store/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Display for Bucket<'_> {
4040

4141
impl Bucket<'_> {
4242
/// Get the bucket and coud provider from the location string
43-
pub fn from_path(path: &str) -> Result<Bucket, Error> {
43+
pub fn from_path(path: &str) -> Result<Bucket<'_>, Error> {
4444
if path.starts_with("s3://") || path.starts_with("s3a://") {
4545
let prefix = if path.starts_with("s3://") {
4646
"s3://"

iceberg-rust/src/table/manifest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use iceberg_rust_spec::{
3737
};
3838
use object_store::ObjectStore;
3939

40-
use crate::{error::Error, spec};
40+
use crate::error::Error;
4141

4242
type ReaderZip<'a, R> = Zip<AvroReader<'a, R>, Repeat<Arc<(Schema, PartitionSpec, FormatVersion)>>>;
4343
type ReaderMap<'a, R> = Map<
@@ -130,8 +130,7 @@ impl<R: Read> ManifestReader<'_, R> {
130130
let partition_spec = PartitionSpec::builder()
131131
.with_spec_id(spec_id)
132132
.with_fields(partition_fields)
133-
.build()
134-
.map_err(spec::error::Error::from)?;
133+
.build()?;
135134
Ok(Self {
136135
reader: reader
137136
.zip(repeat(Arc::new((schema, partition_spec, format_version))))

iceberg-rust/src/table/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl Table {
287287
///
288288
/// The transaction must be committed for any changes to take effect.
289289
/// Multiple operations can be chained within a single transaction.
290-
pub fn new_transaction(&mut self, branch: Option<&str>) -> TableTransaction {
290+
pub fn new_transaction(&mut self, branch: Option<&str>) -> TableTransaction<'_> {
291291
TableTransaction::new(self, branch)
292292
}
293293
}

iceberg-rust/src/table/transaction/operation.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ impl Operation {
149149
.with_format_version(table_metadata.format_version)
150150
.with_status(Status::Added)
151151
.with_data_file(data_file)
152-
.build()
153-
.map_err(crate::spec::error::Error::from)
154-
.map_err(Error::from)
152+
.build().map_err(Error::from)
155153
});
156154

157155
let snapshot_id = generate_snapshot_id();
@@ -198,8 +196,7 @@ impl Operation {
198196
snapshot_builder.with_parent_snapshot_id(*snapshot.snapshot_id());
199197
}
200198
let snapshot = snapshot_builder
201-
.build()
202-
.map_err(iceberg_rust_spec::error::Error::from)?;
199+
.build()?;
203200

204201
Ok((
205202
old_snapshot.map(|x| TableRequirement::AssertRefSnapshotId {
@@ -253,9 +250,7 @@ impl Operation {
253250
.with_snapshot_id(snapshot_id)
254251
.with_sequence_number(sequence_number)
255252
.with_data_file(data_file.clone())
256-
.build()
257-
.map_err(crate::spec::error::Error::from)
258-
.map_err(Error::from)
253+
.build().map_err(Error::from)
259254
});
260255

261256
let manifest_schema = ManifestEntry::schema(
@@ -347,8 +342,7 @@ impl Operation {
347342
other: additional_summary.unwrap_or_default(),
348343
});
349344
let snapshot = snapshot_builder
350-
.build()
351-
.map_err(iceberg_rust_spec::error::Error::from)?;
345+
.build()?;
352346

353347
Ok((
354348
old_snapshot.map(|x| TableRequirement::AssertRefSnapshotId {
@@ -422,9 +416,7 @@ impl Operation {
422416
.with_format_version(table_metadata.format_version)
423417
.with_status(Status::Added)
424418
.with_data_file(data_file)
425-
.build()
426-
.map_err(crate::spec::error::Error::from)
427-
.map_err(Error::from)
419+
.build().map_err(Error::from)
428420
});
429421

430422
let snapshot_id = generate_snapshot_id();
@@ -489,8 +481,7 @@ impl Operation {
489481
);
490482
snapshot_builder.with_parent_snapshot_id(*old_snapshot.snapshot_id());
491483
let snapshot = snapshot_builder
492-
.build()
493-
.map_err(iceberg_rust_spec::error::Error::from)?;
484+
.build()?;
494485

495486
Ok((
496487
Some(TableRequirement::AssertRefSnapshotId {

iceberg-rust/src/view/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl View {
181181
///
182182
/// Transactions ensure that all changes are applied atomically with ACID guarantees.
183183
/// Multiple operations can be chained and will be committed together.
184-
pub fn new_transaction(&mut self, branch: Option<&str>) -> ViewTransaction {
184+
pub fn new_transaction(&mut self, branch: Option<&str>) -> ViewTransaction<'_> {
185185
ViewTransaction::new(self, branch)
186186
}
187187
}

0 commit comments

Comments
 (0)