Skip to content

Commit 5762d5c

Browse files
committed
in work
1 parent fb5799e commit 5762d5c

File tree

35 files changed

+356
-556
lines changed

35 files changed

+356
-556
lines changed

rust/cubestore/Cargo.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/cubestore/cubedatasketches/src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ impl Display for DataSketchesError {
3030

3131
impl DataSketchesError {
3232
pub fn new<Str: ToString>(message: Str) -> Self {
33-
return Self {
33+
Self {
3434
message: message.to_string(),
35-
};
35+
}
3636
}
3737
}
3838

3939
impl From<std::io::Error> for DataSketchesError {
4040
fn from(err: std::io::Error) -> Self {
41-
return DataSketchesError::new(err);
41+
DataSketchesError::new(err)
4242
}
4343
}
4444

4545
#[cfg(not(target_os = "windows"))]
4646
impl From<dsrs::DataSketchesError> for DataSketchesError {
4747
fn from(err: dsrs::DataSketchesError) -> Self {
48-
return DataSketchesError::new(err);
48+
DataSketchesError::new(err)
4949
}
5050
}

rust/cubestore/cubedatasketches/src/native.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ impl Debug for HLLDataSketch {
3737

3838
impl HLLDataSketch {
3939
pub fn read(data: &[u8]) -> Result<Self> {
40-
return Ok(Self {
40+
Ok(Self {
4141
instance: HLLSketch::deserialize(data)?,
42-
});
42+
})
4343
}
4444

4545
pub fn cardinality(&self) -> u64 {
46-
return self.instance.estimate().round() as u64;
46+
self.instance.estimate().round() as u64
4747
}
4848

4949
pub fn get_lg_config_k(&self) -> u8 {
50-
return self.instance.get_lg_config_k();
50+
self.instance.get_lg_config_k()
5151
}
5252

5353
pub fn write(&self) -> Vec<u8> {
5454
// TODO(ovr): Better way?
55-
self.instance.serialize().as_ref().iter().copied().collect()
55+
self.instance.serialize().as_ref().to_vec()
5656
}
5757
}
5858

@@ -80,13 +80,13 @@ impl HLLUnionDataSketch {
8080
}
8181

8282
pub fn get_lg_config_k(&self) -> u8 {
83-
return self.instance.get_lg_config_k();
83+
self.instance.get_lg_config_k()
8484
}
8585

8686
pub fn write(&self) -> Vec<u8> {
8787
let sketch = self.instance.sketch(HLLType::HLL_4);
8888
// TODO(ovr): Better way?
89-
sketch.serialize().as_ref().iter().copied().collect()
89+
sketch.serialize().as_ref().to_vec()
9090
}
9191

9292
pub fn merge_with(&mut self, other: HLLDataSketch) -> Result<()> {
@@ -107,6 +107,6 @@ impl HLLUnionDataSketch {
107107
//
108108
// This function is supposed to be exact, but it is not exact.
109109

110-
return 32 + k;
110+
32 + k
111111
}
112112
}

rust/cubestore/cubehll/src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ impl Display for HllError {
1414

1515
impl HllError {
1616
pub fn new<Str: ToString>(message: Str) -> HllError {
17-
return HllError {
17+
HllError {
1818
message: message.to_string(),
19-
};
19+
}
2020
}
2121
}
2222

2323
impl From<std::io::Error> for HllError {
2424
fn from(err: std::io::Error) -> Self {
25-
return HllError::new(err);
25+
HllError::new(err)
2626
}
2727
}
2828

2929
impl From<serde_json::Error> for HllError {
3030
fn from(err: serde_json::Error) -> Self {
31-
return HllError::new(err);
31+
HllError::new(err)
3232
}
3333
}

0 commit comments

Comments
 (0)