Skip to content

Commit

Permalink
chore: update toolchain to 20231219 (#2932)
Browse files Browse the repository at this point in the history
* update toolchain file, remove unused feature gates

Signed-off-by: Ruihang Xia <[email protected]>

* fix clippy

Signed-off-by: Ruihang Xia <[email protected]>

* fix format

Signed-off-by: Ruihang Xia <[email protected]>

* update action file

Signed-off-by: Ruihang Xia <[email protected]>

* update to 12-19

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored Dec 19, 2023
1 parent 3e6a564 commit 6b8dbcf
Show file tree
Hide file tree
Showing 38 changed files with 82 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apidoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
name: Build API docs

env:
RUST_TOOLCHAIN: nightly-2023-10-21
RUST_TOOLCHAIN: nightly-2023-12-19

jobs:
apidoc:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ concurrency:
cancel-in-progress: true

env:
RUST_TOOLCHAIN: nightly-2023-10-21
RUST_TOOLCHAIN: nightly-2023-12-19

jobs:
typos:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

env:
RUST_TOOLCHAIN: nightly-2023-10-21
RUST_TOOLCHAIN: nightly-2023-12-19

jobs:
sqlness:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ on:
# Use env variables to control all the release process.
env:
# The arguments of building greptime.
RUST_TOOLCHAIN: nightly-2023-10-21
RUST_TOOLCHAIN: nightly-2023-12-19
CARGO_PROFILE: nightly

# Controls whether to run tests, include unit-test, integration-test and sqlness.
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-10-21"
channel = "nightly-2023-12-19"
1 change: 0 additions & 1 deletion src/catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![feature(trait_upcasting)]
#![feature(assert_matches)]
#![feature(try_blocks)]

Expand Down
6 changes: 3 additions & 3 deletions src/common/meta/src/kv_backend/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ mod tests {
let batch_get: BatchGet = req.try_into().unwrap();
let keys = batch_get.keys;

assert_eq!(b"k1".to_vec(), keys.get(0).unwrap().clone());
assert_eq!(b"k1".to_vec(), keys.first().unwrap().clone());
assert_eq!(b"k2".to_vec(), keys.get(1).unwrap().clone());
assert_eq!(b"k3".to_vec(), keys.get(2).unwrap().clone());
}
Expand All @@ -566,7 +566,7 @@ mod tests {

let batch_put: BatchPut = req.try_into().unwrap();

let kv = batch_put.kvs.get(0).unwrap();
let kv = batch_put.kvs.first().unwrap();
assert_eq!(b"test_key", kv.key());
assert_eq!(b"test_value", kv.value());
let _ = batch_put.options.unwrap();
Expand All @@ -582,7 +582,7 @@ mod tests {
let batch_delete: BatchDelete = req.try_into().unwrap();

assert_eq!(batch_delete.keys.len(), 3);
assert_eq!(b"k1".to_vec(), batch_delete.keys.get(0).unwrap().clone());
assert_eq!(b"k1".to_vec(), batch_delete.keys.first().unwrap().clone());
assert_eq!(b"k2".to_vec(), batch_delete.keys.get(1).unwrap().clone());
assert_eq!(b"k3".to_vec(), batch_delete.keys.get(2).unwrap().clone());
let _ = batch_delete.options.unwrap();
Expand Down
8 changes: 4 additions & 4 deletions src/common/meta/src/rpc/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ mod tests {
let into_req: PbBatchGetRequest = req.into();

assert!(into_req.header.is_none());
assert_eq!(b"test_key1".as_slice(), into_req.keys.get(0).unwrap());
assert_eq!(b"test_key1".as_slice(), into_req.keys.first().unwrap());
assert_eq!(b"test_key2".as_slice(), into_req.keys.get(1).unwrap());
assert_eq!(b"test_key3".as_slice(), into_req.keys.get(2).unwrap());
}
Expand Down Expand Up @@ -946,10 +946,10 @@ mod tests {

let into_req: PbBatchPutRequest = req.into();
assert!(into_req.header.is_none());
assert_eq!(b"test_key1".to_vec(), into_req.kvs.get(0).unwrap().key);
assert_eq!(b"test_key1".to_vec(), into_req.kvs.first().unwrap().key);
assert_eq!(b"test_key2".to_vec(), into_req.kvs.get(1).unwrap().key);
assert_eq!(b"test_key3".to_vec(), into_req.kvs.get(2).unwrap().key);
assert_eq!(b"test_value1".to_vec(), into_req.kvs.get(0).unwrap().value);
assert_eq!(b"test_value1".to_vec(), into_req.kvs.first().unwrap().value);
assert_eq!(b"test_value2".to_vec(), into_req.kvs.get(1).unwrap().value);
assert_eq!(b"test_value3".to_vec(), into_req.kvs.get(2).unwrap().value);
assert!(into_req.prev_kv);
Expand Down Expand Up @@ -981,7 +981,7 @@ mod tests {

let into_req: PbBatchDeleteRequest = req.into();
assert!(into_req.header.is_none());
assert_eq!(&b"test_key1".to_vec(), into_req.keys.get(0).unwrap());
assert_eq!(&b"test_key1".to_vec(), into_req.keys.first().unwrap());
assert_eq!(&b"test_key2".to_vec(), into_req.keys.get(1).unwrap());
assert_eq!(&b"test_key3".to_vec(), into_req.keys.get(2).unwrap());
assert!(into_req.prev_kv);
Expand Down
1 change: 0 additions & 1 deletion src/common/substrait/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

#![feature(let_chains)]
#![feature(trait_upcasting)]

mod df_substrait;
pub mod error;
Expand Down
1 change: 0 additions & 1 deletion src/datanode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

#![feature(assert_matches)]
#![feature(trait_upcasting)]

pub mod alive_keeper;
pub mod config;
Expand Down
1 change: 0 additions & 1 deletion src/datatypes/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

pub use crate::data_type::{ConcreteDataType, DataType, DataTypeRef};
pub use crate::macros::*;
pub use crate::scalars::{Scalar, ScalarRef, ScalarVector, ScalarVectorBuilder};
pub use crate::type_id::LogicalTypeId;
pub use crate::types::{LogicalPrimitiveType, WrapperType};
Expand Down
4 changes: 3 additions & 1 deletion src/datatypes/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ impl Schema {
let mut column_schemas = Vec::with_capacity(indices.len());
let mut timestamp_index = None;
for index in indices {
if let Some(ts_index) = self.timestamp_index && ts_index == *index {
if let Some(ts_index) = self.timestamp_index
&& ts_index == *index
{
timestamp_index = Some(column_schemas.len());
}
column_schemas.push(self.column_schemas[*index].clone());
Expand Down
1 change: 0 additions & 1 deletion src/file-engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

#![feature(assert_matches)]
#![feature(result_option_inspect)]

pub mod config;
pub mod engine;
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

#![feature(assert_matches)]
#![feature(trait_upcasting)]

pub mod error;
pub mod frontend;
Expand Down
2 changes: 1 addition & 1 deletion src/meta-srv/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ mod tests {
let _ = kv_map.get(&stat_key).unwrap();

let stat_val = kv_map.get(&stat_key).unwrap();
let stat = stat_val.stats.get(0).unwrap();
let stat = stat_val.stats.first().unwrap();

assert_eq!(0, stat.cluster_id);
assert_eq!(100, stat.id);
Expand Down
4 changes: 2 additions & 2 deletions src/meta-srv/src/handler/persist_stats_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod tests {
cluster_id: 3,
node_id: 101,
};
let key: Vec<u8> = key.try_into().unwrap();
let key: Vec<u8> = key.into();
let res = ctx.in_memory.get(&key).await.unwrap();
let kv = res.unwrap();
let key: StatKey = kv.key.clone().try_into().unwrap();
Expand All @@ -203,7 +203,7 @@ mod tests {

handle_request_many_times(ctx.clone(), &handler, 10).await;

let key: Vec<u8> = key.try_into().unwrap();
let key: Vec<u8> = key.into();
let res = ctx.in_memory.get(&key).await.unwrap();
let kv = res.unwrap();
let val: StatValue = kv.value.try_into().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/meta-srv/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod tests {
node_id: 1,
};

let key_bytes: Vec<u8> = key.try_into().unwrap();
let key_bytes: Vec<u8> = key.into();
let new_key: StatKey = key_bytes.try_into().unwrap();

assert_eq!(0, new_key.cluster_id);
Expand All @@ -338,7 +338,7 @@ mod tests {

assert_eq!(1, stats.len());

let stat = stats.get(0).unwrap();
let stat = stats.first().unwrap();
assert_eq!(0, stat.cluster_id);
assert_eq!(101, stat.id);
assert_eq!(100, stat.region_num);
Expand Down Expand Up @@ -452,7 +452,7 @@ mod tests {
region_id: 2,
};

let key_bytes: Vec<u8> = key.try_into().unwrap();
let key_bytes: Vec<u8> = key.into();
let new_key: InactiveRegionKey = key_bytes.try_into().unwrap();

assert_eq!(new_key, key);
Expand Down
6 changes: 3 additions & 3 deletions src/meta-srv/src/service/admin/heartbeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ mod tests {
let mut stat_vals = vec![stat_value1, stat_value2];
stat_vals = filter_by_addr(stat_vals, "127.0.0.1:3002");
assert_eq!(stat_vals.len(), 1);
assert_eq!(stat_vals.get(0).unwrap().stats.len(), 3);
assert_eq!(stat_vals.first().unwrap().stats.len(), 3);
assert_eq!(
stat_vals
.get(0)
.first()
.unwrap()
.stats
.get(0)
.first()
.unwrap()
.timestamp_millis,
3
Expand Down
28 changes: 21 additions & 7 deletions src/mito2/src/compaction/twcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ impl TwcsPicker {
) -> Vec<CompactionOutput> {
let mut output = vec![];
for (window, files) in time_windows {
if let Some(active_window) = active_window && *window == active_window {
if let Some(active_window) = active_window
&& *window == active_window
{
if files.len() > self.max_active_window_files {
output.push(CompactionOutput {
output_file_id: FileId::random(),
output_level: 1, // we only have two levels and always compact to l1
output_level: 1, // we only have two levels and always compact to l1
inputs: files.clone(),
});
} else {
Expand All @@ -102,7 +104,11 @@ impl TwcsPicker {
inputs: files.clone(),
});
} else {
debug!("No enough files, current: {}, max_inactive_window_files: {}", files.len(), self.max_inactive_window_files)
debug!(
"No enough files, current: {}, max_inactive_window_files: {}",
files.len(),
self.max_inactive_window_files
)
}
}
}
Expand Down Expand Up @@ -207,7 +213,9 @@ fn find_latest_window_in_seconds<'a>(
let mut latest_timestamp = None;
for f in files {
let (_, end) = f.time_range();
if let Some(latest) = latest_timestamp && end > latest {
if let Some(latest) = latest_timestamp
&& end > latest
{
latest_timestamp = Some(end);
} else {
latest_timestamp = Some(end);
Expand Down Expand Up @@ -542,11 +550,17 @@ mod tests {
.iter(),
3,
);
assert_eq!(files[0], windows.get(&0).unwrap().get(0).unwrap().file_id());
assert_eq!(files[1], windows.get(&3).unwrap().get(0).unwrap().file_id());
assert_eq!(
files[0],
windows.get(&0).unwrap().first().unwrap().file_id()
);
assert_eq!(
files[1],
windows.get(&3).unwrap().first().unwrap().file_id()
);
assert_eq!(
files[2],
windows.get(&12).unwrap().get(0).unwrap().file_id()
windows.get(&12).unwrap().first().unwrap().file_id()
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/mito2/src/memtable/time_series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ mod tests {
v0.extend(
values
.fields
.get(0)
.first()
.unwrap()
.as_any()
.downcast_ref::<Int64Vector>()
Expand Down Expand Up @@ -1125,7 +1125,7 @@ mod tests {
assert_eq!(1, batch.fields().len());
let v0 = batch
.fields()
.get(0)
.first()
.unwrap()
.data
.as_any()
Expand Down
2 changes: 1 addition & 1 deletion src/mito2/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl WriteRequest {
let row_size = self
.rows
.rows
.get(0)
.first()
.map(|row| row.encoded_len())
.unwrap_or(0);
row_size * self.rows.rows.len()
Expand Down
2 changes: 1 addition & 1 deletion src/object-store/tests/object_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async fn test_object_list(store: &ObjectStore) -> Result<()> {
// Only o2 is exists
let entries = store.list("/").await?;
assert_eq!(1, entries.len());
assert_eq!(p2, entries.get(0).unwrap().path());
assert_eq!(p2, entries.first().unwrap().path());

let content = store.read(p2).await?;
assert_eq!("Hello, object2!", String::from_utf8(content)?);
Expand Down
4 changes: 2 additions & 2 deletions src/partition/src/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ mod tests {
}

fn find_region(&self, values: &[Value]) -> Result<RegionNumber> {
let val = values.get(0).unwrap().clone();
let val = values.first().unwrap().clone();
let val = match val {
Value::String(v) => v.as_utf8().to_string(),
_ => unreachable!(),
Expand All @@ -229,7 +229,7 @@ mod tests {
}

fn find_region(&self, values: &[Value]) -> Result<RegionNumber> {
let val = values.get(0).unwrap().clone();
let val = values.first().unwrap().clone();
let val = match val {
Value::Null => 1,
_ => 0,
Expand Down
4 changes: 3 additions & 1 deletion src/promql/src/extension_plan/histogram_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,9 @@ impl HistogramFoldStream {
))
})?;
for (i, v) in le_as_f64_array.iter().enumerate() {
if let Some(v) = v && v == f64::INFINITY {
if let Some(v) = v
&& v == f64::INFINITY
{
return Ok(i);
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/promql/src/extension_plan/instant_manipulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ impl InstantManipulateStream {
let curr = ts_column.value(cursor);
match curr.cmp(&expected_ts) {
Ordering::Equal => {
if let Some(field_column) = &field_column && field_column.value(cursor).is_nan() {
if let Some(field_column) = &field_column
&& field_column.value(cursor).is_nan()
{
// ignore the NaN value
} else {
take_indices.push(cursor as u64);
Expand Down Expand Up @@ -393,7 +395,8 @@ impl InstantManipulateStream {
if prev_ts + self.lookback_delta >= expected_ts {
// only use the point in the time range
if let Some(field_column) = &field_column
&& field_column.value(prev_cursor).is_nan() {
&& field_column.value(prev_cursor).is_nan()
{
// if the newest value is NaN, it means the value is stale, so we should not use it
continue;
}
Expand All @@ -402,7 +405,9 @@ impl InstantManipulateStream {
aligned_ts.push(expected_ts);
}
}
} else if let Some(field_column) = &field_column && field_column.value(cursor).is_nan() {
} else if let Some(field_column) = &field_column
&& field_column.value(cursor).is_nan()
{
// if the newest value is NaN, it means the value is stale, so we should not use it
} else {
// use this point
Expand Down
2 changes: 1 addition & 1 deletion src/promql/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl PromPlanner {
.time_index_column
.clone()
.expect("time index should be set in `setup_context`"),
self.ctx.field_columns.get(0).cloned(),
self.ctx.field_columns.first().cloned(),
normalize,
);
LogicalPlan::Extension(Extension {
Expand Down
Loading

0 comments on commit 6b8dbcf

Please sign in to comment.