chore: upgrade rust version to 1.70 (#2749)

* chore: upgrade rust version to 1.70

* ci: fix wanrings

* ci: fix clippy warings
This commit is contained in:
Nathan.fooo 2023-06-09 22:23:07 +08:00 committed by GitHub
parent 133ac72317
commit ab5a3dae3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 102 additions and 263 deletions

View File

@ -23,7 +23,7 @@ on:
env:
FLUTTER_VERSION: "3.10.1"
RUST_TOOLCHAIN: "1.65"
RUST_TOOLCHAIN: "1.70"
jobs:
build:

View File

@ -7,7 +7,7 @@ on:
env:
FLUTTER_VERSION: "3.10.1"
RUST_TOOLCHAIN: "1.65"
RUST_TOOLCHAIN: "1.70"
jobs:
create-release:

View File

@ -21,7 +21,7 @@ on:
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: "1.65"
RUST_TOOLCHAIN: "1.70"
FLUTTER_VERSION: "3.10.1"
jobs:

View File

@ -12,7 +12,7 @@ on:
env:
CARGO_TERM_COLOR: always
FLUTTER_VERSION: "3.10.1"
RUST_TOOLCHAIN: "1.65"
RUST_TOOLCHAIN: "1.70"
jobs:
tests:

View File

@ -8,7 +8,7 @@ on:
env:
NODE_VERSION: "18.16.0"
PNPM_VERSION: "8.5.0"
RUST_TOOLCHAIN: "1.65"
RUST_TOOLCHAIN: "1.70"
jobs:
tauri-build:

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.65"
channel = "1.70"

View File

@ -58,7 +58,7 @@ pub extern "C" fn async_event(port: i64, input: *const u8, len: usize) {
},
Some(e) => e.event_dispatcher.clone(),
};
let _ = AFPluginDispatcher::async_send_with_callback(
AFPluginDispatcher::async_send_with_callback(
dispatcher,
request,
move |resp: AFPluginEventResponse| {

View File

@ -1,19 +1,14 @@
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use lib_dispatch::prelude::{AFPluginEventResponse, Payload, StatusCode};
#[derive(ProtoBuf_Enum, Clone, Copy)]
#[derive(ProtoBuf_Enum, Clone, Copy, Default)]
pub enum FFIStatusCode {
#[default]
Ok = 0,
Err = 1,
Internal = 2,
}
impl std::default::Default for FFIStatusCode {
fn default() -> FFIStatusCode {
FFIStatusCode::Ok
}
}
#[derive(ProtoBuf, Default)]
pub struct FFIResponse {
#[pb(index = 1)]

View File

@ -45,7 +45,7 @@ impl SnapshotPersistence for SnapshotDBImpl {
.map_err(|e| PersistenceError::Internal(Box::new(e)))?,
);
let _ = tokio::task::spawn_blocking(move || {
tokio::task::spawn_blocking(move || {
if let Some(pool) = weak_pool.upgrade() {
let conn = pool
.get()

View File

@ -475,7 +475,9 @@ pub struct FieldChangesetParams {
Deserialize_repr,
)]
#[repr(u8)]
#[derive(Default)]
pub enum FieldType {
#[default]
RichText = 0,
Number = 1,
DateTime = 2,
@ -488,12 +490,6 @@ pub enum FieldType {
CreatedTime = 9,
}
impl std::default::Default for FieldType {
fn default() -> Self {
FieldType::RichText
}
}
impl Display for FieldType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let value: i64 = self.clone().into();

View File

@ -10,7 +10,9 @@ pub struct CheckboxFilterPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum CheckboxFilterConditionPB {
#[default]
IsChecked = 0,
IsUnChecked = 1,
}
@ -21,12 +23,6 @@ impl std::convert::From<CheckboxFilterConditionPB> for u32 {
}
}
impl std::default::Default for CheckboxFilterConditionPB {
fn default() -> Self {
CheckboxFilterConditionPB::IsChecked
}
}
impl std::convert::TryFrom<u8> for CheckboxFilterConditionPB {
type Error = ErrorCode;

View File

@ -10,8 +10,10 @@ pub struct ChecklistFilterPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum ChecklistFilterConditionPB {
IsComplete = 0,
#[default]
IsIncomplete = 1,
}
@ -21,12 +23,6 @@ impl std::convert::From<ChecklistFilterConditionPB> for u32 {
}
}
impl std::default::Default for ChecklistFilterConditionPB {
fn default() -> Self {
ChecklistFilterConditionPB::IsIncomplete
}
}
impl std::convert::TryFrom<u8> for ChecklistFilterConditionPB {
type Error = ErrorCode;

View File

@ -42,7 +42,9 @@ impl FromStr for DateFilterContentPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum DateFilterConditionPB {
#[default]
DateIs = 0,
DateBefore = 1,
DateAfter = 2,
@ -58,11 +60,6 @@ impl std::convert::From<DateFilterConditionPB> for u32 {
value as u32
}
}
impl std::default::Default for DateFilterConditionPB {
fn default() -> Self {
DateFilterConditionPB::DateIs
}
}
impl std::convert::TryFrom<u8> for DateFilterConditionPB {
type Error = ErrorCode;

View File

@ -13,7 +13,9 @@ pub struct NumberFilterPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum NumberFilterConditionPB {
#[default]
Equal = 0,
NotEqual = 1,
GreaterThan = 2,
@ -24,12 +26,6 @@ pub enum NumberFilterConditionPB {
NumberIsNotEmpty = 7,
}
impl std::default::Default for NumberFilterConditionPB {
fn default() -> Self {
NumberFilterConditionPB::Equal
}
}
impl std::convert::From<NumberFilterConditionPB> for u32 {
fn from(value: NumberFilterConditionPB) -> Self {
value as u32

View File

@ -14,7 +14,9 @@ pub struct SelectOptionFilterPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum SelectOptionConditionPB {
#[default]
OptionIs = 0,
OptionIsNot = 1,
OptionIsEmpty = 2,
@ -27,12 +29,6 @@ impl std::convert::From<SelectOptionConditionPB> for u32 {
}
}
impl std::default::Default for SelectOptionConditionPB {
fn default() -> Self {
SelectOptionConditionPB::OptionIs
}
}
impl std::convert::TryFrom<u8> for SelectOptionConditionPB {
type Error = ErrorCode;

View File

@ -13,7 +13,9 @@ pub struct TextFilterPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum TextFilterConditionPB {
#[default]
Is = 0,
IsNot = 1,
Contains = 2,
@ -30,12 +32,6 @@ impl std::convert::From<TextFilterConditionPB> for u32 {
}
}
impl std::default::Default for TextFilterConditionPB {
fn default() -> Self {
TextFilterConditionPB::Is
}
}
impl std::convert::TryFrom<u8> for TextFilterConditionPB {
type Error = ErrorCode;

View File

@ -54,7 +54,9 @@ pub struct DateGroupConfigurationPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum)]
#[repr(u8)]
#[derive(Default)]
pub enum DateCondition {
#[default]
Relative = 0,
Day = 1,
Week = 2,
@ -62,12 +64,6 @@ pub enum DateCondition {
Year = 4,
}
impl std::default::Default for DateCondition {
fn default() -> Self {
DateCondition::Relative
}
}
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
pub struct CheckboxGroupConfigurationPB {
#[pb(index = 1)]

View File

@ -35,18 +35,14 @@ pub struct DatabaseViewSettingPB {
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]
#[repr(u8)]
#[derive(Default)]
pub enum DatabaseLayoutPB {
#[default]
Grid = 0,
Board = 1,
Calendar = 2,
}
impl std::default::Default for DatabaseLayoutPB {
fn default() -> Self {
DatabaseLayoutPB::Grid
}
}
impl std::convert::From<DatabaseLayout> for DatabaseLayoutPB {
fn from(rev: DatabaseLayout) -> Self {
match rev {

View File

@ -1,16 +1,11 @@
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
#[derive(Debug, ProtoBuf_Enum, Clone)]
#[derive(Debug, ProtoBuf_Enum, Clone, Default)]
pub enum DatabaseExportDataType {
#[default]
CSV = 0,
}
impl Default for DatabaseExportDataType {
fn default() -> Self {
DatabaseExportDataType::CSV
}
}
#[derive(Debug, ProtoBuf, Default, Clone)]
pub struct DatabaseExportDataPB {
#[pb(index = 1)]

View File

@ -75,19 +75,15 @@ impl From<DateTypeOptionPB> for DateTypeOption {
}
}
#[derive(Clone, Debug, Copy, EnumIter, ProtoBuf_Enum)]
#[derive(Clone, Debug, Copy, EnumIter, ProtoBuf_Enum, Default)]
pub enum DateFormatPB {
Local = 0,
US = 1,
ISO = 2,
#[default]
Friendly = 3,
DayMonthYear = 4,
}
impl std::default::Default for DateFormatPB {
fn default() -> Self {
DateFormatPB::Friendly
}
}
impl From<DateFormatPB> for DateFormat {
fn from(data: DateFormatPB) -> Self {
@ -113,18 +109,13 @@ impl From<DateFormat> for DateFormatPB {
}
}
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, ProtoBuf_Enum)]
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, ProtoBuf_Enum, Default)]
pub enum TimeFormatPB {
TwelveHour = 0,
#[default]
TwentyFourHour = 1,
}
impl std::default::Default for TimeFormatPB {
fn default() -> Self {
TimeFormatPB::TwentyFourHour
}
}
impl From<TimeFormatPB> for TimeFormat {
fn from(data: TimeFormatPB) -> Self {
match data {

View File

@ -39,8 +39,9 @@ impl From<NumberTypeOptionPB> for NumberTypeOption {
}
}
#[derive(Clone, Copy, Debug, ProtoBuf_Enum)]
#[derive(Clone, Copy, Debug, ProtoBuf_Enum, Default)]
pub enum NumberFormatPB {
#[default]
Num = 0,
USD = 1,
CanadianDollar = 2,
@ -79,12 +80,6 @@ pub enum NumberFormatPB {
Percent = 36,
}
impl std::default::Default for NumberFormatPB {
fn default() -> Self {
NumberFormatPB::Num
}
}
impl From<NumberFormat> for NumberFormatPB {
fn from(data: NumberFormat) -> Self {
match data {

View File

@ -57,7 +57,9 @@ pub struct RepeatedSelectOptionPayload {
#[derive(ProtoBuf_Enum, PartialEq, Eq, Debug, Clone)]
#[repr(u8)]
#[derive(Default)]
pub enum SelectOptionColorPB {
#[default]
Purple = 0,
Pink = 1,
LightPink = 2,
@ -69,12 +71,6 @@ pub enum SelectOptionColorPB {
Blue = 8,
}
impl std::default::Default for SelectOptionColorPB {
fn default() -> Self {
SelectOptionColorPB::Purple
}
}
impl From<SelectOptionColor> for SelectOptionColorPB {
fn from(data: SelectOptionColor) -> Self {
match data {

View File

@ -3,8 +3,9 @@ use flowy_notification::NotificationBuilder;
const OBSERVABLE_CATEGORY: &str = "Grid";
#[derive(ProtoBuf_Enum, Debug)]
#[derive(ProtoBuf_Enum, Debug, Default)]
pub enum DatabaseNotification {
#[default]
Unknown = 0,
/// Trigger after inserting/deleting/updating a row
DidUpdateViewRows = 20,
@ -44,12 +45,6 @@ pub enum DatabaseNotification {
DidMoveDatabaseViewToTrash = 84,
}
impl std::default::Default for DatabaseNotification {
fn default() -> Self {
DatabaseNotification::Unknown
}
}
impl std::convert::From<DatabaseNotification> for i32 {
fn from(notification: DatabaseNotification) -> Self {
notification as i32

View File

@ -1059,8 +1059,8 @@ fn cell_changesets_from_cell_by_field_id(
) -> Vec<CellChangesetNotifyPB> {
let row_id = row_id.into_inner();
cell_by_field_id
.into_iter()
.map(|(field_id, _cell)| CellChangesetNotifyPB {
.into_keys()
.map(|field_id| CellChangesetNotifyPB {
view_id: view_id.to_string(),
row_id: row_id.clone(),
field_id,

View File

@ -675,7 +675,7 @@ impl DatabaseViewEditor {
let filter_type = UpdatedFilterType::new(Some(old), new);
let filter_changeset = FilterChangeset::from_update(filter_type);
let filter_controller = self.filter_controller.clone();
let _ = tokio::spawn(async move {
tokio::spawn(async move {
if let Some(notification) = filter_controller
.did_receive_changes(filter_changeset)
.await

View File

@ -251,7 +251,7 @@ impl CellDataChangeset for DateTypeOption {
Ok(time) => Ok(Some(time)),
Err(_e) => {
let msg = format!("Parse {} failed", time_str);
Err(FlowyError::new(ErrorCode::InvalidDateTimeFormat, &msg))
Err(FlowyError::new(ErrorCode::InvalidDateTimeFormat, msg))
},
}
},

View File

@ -191,19 +191,15 @@ impl ToString for DateCellData {
}
}
#[derive(Clone, Debug, Copy, EnumIter, Serialize, Deserialize)]
#[derive(Clone, Debug, Copy, EnumIter, Serialize, Deserialize, Default)]
pub enum DateFormat {
Local = 0,
US = 1,
ISO = 2,
#[default]
Friendly = 3,
DayMonthYear = 4,
}
impl std::default::Default for DateFormat {
fn default() -> Self {
DateFormat::Friendly
}
}
impl std::convert::From<i64> for DateFormat {
fn from(value: i64) -> Self {
@ -237,9 +233,10 @@ impl DateFormat {
}
}
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, Serialize, Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, EnumIter, Debug, Hash, Serialize, Deserialize, Default)]
pub enum TimeFormat {
TwelveHour = 0,
#[default]
TwentyFourHour = 1,
}
@ -270,12 +267,6 @@ impl TimeFormat {
}
}
impl std::default::Default for TimeFormat {
fn default() -> Self {
TimeFormat::TwentyFourHour
}
}
impl DecodedCellData for DateCellDataPB {
type Object = DateCellDataPB;

View File

@ -12,8 +12,9 @@ lazy_static! {
.collect::<Vec<String>>();
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumIter, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumIter, Serialize, Deserialize, Default)]
pub enum NumberFormat {
#[default]
Num = 0,
USD = 1,
CanadianDollar = 2,
@ -58,12 +59,6 @@ impl NumberFormat {
}
}
impl std::default::Default for NumberFormat {
fn default() -> Self {
NumberFormat::Num
}
}
impl From<i64> for NumberFormat {
fn from(value: i64) -> Self {
match value {

View File

@ -31,7 +31,9 @@ impl SelectOption {
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[repr(u8)]
#[derive(Default)]
pub enum SelectOptionColor {
#[default]
Purple = 0,
Pink = 1,
LightPink = 2,
@ -43,12 +45,6 @@ pub enum SelectOptionColor {
Blue = 8,
}
impl std::default::Default for SelectOptionColor {
fn default() -> Self {
SelectOptionColor::Purple
}
}
#[derive(Debug)]
pub struct SelectOptionCellData {
pub options: Vec<SelectOption>,

View File

@ -72,16 +72,15 @@ mod tests {
let field_type = FieldType::MultiSelect;
let france = SelectOption::new("france");
let france_option_id = france.id.clone();
let argentina = SelectOption::new("argentina");
let argentina_option_id = argentina.id.clone();
let multi_select = MultiSelectTypeOption {
options: vec![france.clone(), argentina.clone()],
disable_color: false,
};
let france_option_id = france.id;
let argentina_option_id = argentina.id;
let field_rev = FieldBuilder::new(field_type.clone(), multi_select).build();
assert_eq!(

View File

@ -55,7 +55,6 @@ impl CSVImporter {
let rows = reader
.records()
.into_iter()
.flat_map(|r| r.ok())
.map(|record| {
record

View File

@ -158,19 +158,14 @@ pub struct BlockEventPayloadPB {
pub value: String,
}
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone, Default)]
pub enum ExportType {
#[default]
Text = 0,
Markdown = 1,
Link = 2,
}
impl Default for ExportType {
fn default() -> Self {
ExportType::Text
}
}
impl From<i32> for ExportType {
fn from(val: i32) -> Self {
match val {
@ -203,17 +198,12 @@ pub struct ExportDataPB {
#[pb(index = 2)]
pub export_type: ExportType,
}
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone, Default)]
pub enum ConvertType {
#[default]
Json = 0,
}
impl Default for ConvertType {
fn default() -> Self {
ConvertType::Json
}
}
impl From<i32> for ConvertType {
fn from(val: i32) -> Self {
match val {

View File

@ -3,19 +3,14 @@ use flowy_notification::NotificationBuilder;
const OBSERVABLE_CATEGORY: &str = "Document";
#[derive(ProtoBuf_Enum, Debug)]
#[derive(ProtoBuf_Enum, Debug, Default)]
pub(crate) enum DocumentNotification {
#[default]
Unknown = 0,
DidReceiveUpdate = 1,
}
impl std::default::Default for DocumentNotification {
fn default() -> Self {
DocumentNotification::Unknown
}
}
impl std::convert::From<DocumentNotification> for i32 {
fn from(notification: DocumentNotification) -> Self {
notification as i32

View File

@ -31,7 +31,7 @@ macro_rules! static_flowy_error {
impl FlowyError {
pub fn new<T: ToString>(code: ErrorCode, msg: T) -> Self {
Self {
code: code.value() as i32,
code: code.value(),
msg: msg.to_string(),
}
}
@ -94,7 +94,7 @@ impl FlowyError {
impl std::convert::From<ErrorCode> for FlowyError {
fn from(code: ErrorCode) -> Self {
FlowyError {
code: code.value() as i32,
code: code.value(),
msg: format!("{}", code),
}
}

View File

@ -22,7 +22,7 @@ lib-infra = { path = "../../../shared-lib/lib-infra" }
tokio = { version = "1.26", features = ["full"] }
nanoid = "0.4.0"
lazy_static = "1.4.0"
chrono = { version = "0.4.24"}
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
strum = "0.21"
strum_macros = "0.21"
protobuf = {version = "2.28.0"}

View File

@ -57,20 +57,15 @@ pub fn view_pb_with_child_views(view: View, child_views: Vec<View>) -> ViewPB {
}
}
#[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone)]
#[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone, Default)]
pub enum ViewLayoutPB {
#[default]
Document = 0,
Grid = 1,
Board = 2,
Calendar = 3,
}
impl std::default::Default for ViewLayoutPB {
fn default() -> Self {
ViewLayoutPB::Document
}
}
impl ViewLayoutPB {
pub fn is_database(&self) -> bool {
matches!(

View File

@ -6,8 +6,9 @@ use lib_dispatch::prelude::ToBytes;
const OBSERVABLE_CATEGORY: &str = "Workspace";
#[derive(ProtoBuf_Enum, Debug)]
#[derive(ProtoBuf_Enum, Debug, Default)]
pub(crate) enum FolderNotification {
#[default]
Unknown = 0,
/// Trigger after creating a workspace
DidCreateWorkspace = 1,
@ -31,12 +32,6 @@ pub(crate) enum FolderNotification {
DidUpdateTrash = 34,
}
impl std::default::Default for FolderNotification {
fn default() -> Self {
FolderNotification::Unknown
}
}
impl std::convert::From<FolderNotification> for i32 {
fn from(notification: FolderNotification) -> Self {
notification as i32

View File

@ -1,7 +1,8 @@
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
#[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq)]
#[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq, Default)]
pub enum NetworkTypePB {
#[default]
Unknown = 0,
Wifi = 1,
Cell = 2,
@ -21,12 +22,6 @@ impl NetworkTypePB {
}
}
impl std::default::Default for NetworkTypePB {
fn default() -> Self {
NetworkTypePB::Unknown
}
}
#[derive(ProtoBuf, Debug, Default, Clone)]
pub struct NetworkStatePB {
#[pb(index = 1)]

View File

@ -24,7 +24,7 @@ postgrest = "1.0"
tokio-retry = "0.3"
anyhow = "1.0"
uuid = { version = "1.3.3", features = ["v4"] }
chrono = "0.4.24"
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
lib-infra = { path = "../../../shared-lib/lib-infra" }
flowy-user = { path = "../flowy-user" }

View File

@ -9,7 +9,6 @@ use std::{fmt::Debug, io, path::Path};
pub use diesel::*;
pub use diesel_derives::*;
use diesel_migrations::*;
use crate::sqlite::PoolConfig;
pub use crate::sqlite::{ConnectionPool, DBConnection, Database};

View File

@ -49,19 +49,14 @@ pub struct AppearanceSettingsPB {
const DEFAULT_RESET_VALUE: fn() -> bool = || APPEARANCE_RESET_AS_DEFAULT;
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug)]
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug, Default)]
pub enum ThemeModePB {
Light = 0,
Dark = 1,
#[default]
System = 2,
}
impl std::default::Default for ThemeModePB {
fn default() -> Self {
ThemeModePB::System
}
}
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
pub struct LocaleSettingsPB {
#[pb(index = 1)]

View File

@ -2,19 +2,14 @@ use flowy_derive::ProtoBuf_Enum;
use flowy_notification::NotificationBuilder;
const OBSERVABLE_CATEGORY: &str = "User";
#[derive(ProtoBuf_Enum, Debug)]
#[derive(ProtoBuf_Enum, Debug, Default)]
pub(crate) enum UserNotification {
#[default]
Unknown = 0,
DidUserSignIn = 1,
DidUpdateUserProfile = 2,
}
impl std::default::Default for UserNotification {
fn default() -> Self {
UserNotification::Unknown
}
}
impl std::convert::From<UserNotification> for i32 {
fn from(notification: UserNotification) -> Self {
notification as i32

View File

@ -177,7 +177,7 @@ impl UserSession {
let server = self.cloud_services.get_auth_service()?;
let token = session.token;
let _ = tokio::spawn(async move {
tokio::spawn(async move {
match server.sign_out(token).await {
Ok(_) => {},
Err(e) => tracing::error!("Sign out failed: {:?}", e),

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.65"
channel = "1.70"

14
shared-lib/Cargo.lock generated
View File

@ -164,11 +164,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
dependencies = [
"iana-time-zone",
"js-sys",
"num-integer",
"num-traits",
"time",
"wasm-bindgen",
"winapi",
]
@ -1737,17 +1734,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "tinyvec"
version = "1.5.1"

View File

@ -133,6 +133,8 @@ fn write_rust_crate_mod_file(crate_contexts: &[ProtobufCrateContext]) {
let mut mod_file_content = String::new();
mod_file_content.push_str("#![cfg_attr(rustfmt, rustfmt::skip)]\n");
mod_file_content.push_str(" #![allow(ambiguous_glob_reexports)]\n");
mod_file_content.push_str("// Auto-generated, do not edit\n");
walk_dir(
context.protobuf_crate.proto_output_path(),

View File

@ -27,6 +27,7 @@ impl ProtobufCrateContext {
let mod_file_path =
path_string_with_component(&self.protobuf_crate.protobuf_crate_path(), vec!["mod.rs"]);
let mut content = "#![cfg_attr(rustfmt, rustfmt::skip)]\n".to_owned();
content.push_str(" #![allow(ambiguous_glob_reexports)]\n");
content.push_str("// Auto-generated, do not edit\n");
content.push_str("mod model;\npub use model::*;");
match OpenOptions::new()

View File

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
chrono = "0.4.23"
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
bytes = { version = "1.4" }
pin-project = "1.0.12"
futures-core = { version = "0.3" }

View File

@ -44,9 +44,7 @@ impl<T, E> FutureResult<T, E> {
where
F: Future<Output = Result<T, E>> + Send + Sync + 'static,
{
Self {
fut: Box::pin(async { f.await }),
}
Self { fut: Box::pin(f) }
}
}

View File

@ -91,7 +91,7 @@ impl<'de> Deserialize<'de> for AttributeValue {
where
E: de::Error,
{
Ok(AttributeValue::from_int(value as i64))
Ok(AttributeValue::from_int(value))
}
fn visit_u8<E>(self, value: u8) -> Result<Self::Value, E>
@ -133,7 +133,7 @@ impl<'de> Deserialize<'de> for AttributeValue {
where
E: de::Error,
{
Ok(AttributeValue::from_float(value as f64))
Ok(AttributeValue::from_float(value))
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>

View File

@ -245,7 +245,7 @@ fn check_bound(current: usize, target: usize) -> Result<(), OTError> {
let msg = format!("{} should be greater than current: {}", target, current);
return Err(
ErrorBuilder::new(OTErrorCode::IncompatibleLength)
.msg(&msg)
.msg(msg)
.build(),
);
}

View File

@ -112,7 +112,7 @@ where
if n == 0 {
return;
}
self.utf16_base_len += n as usize;
self.utf16_base_len += n;
if let Some(DeltaOperation::Delete(n_last)) = self.ops.last_mut() {
*n_last += n;
} else {
@ -156,8 +156,8 @@ where
if n == 0 {
return;
}
self.utf16_base_len += n as usize;
self.utf16_target_len += n as usize;
self.utf16_base_len += n;
self.utf16_target_len += n;
if let Some(DeltaOperation::<T>::Retain(retain)) = self.ops.last_mut() {
if let Some(new_op) = retain.merge_or_new(n, attributes) {
@ -212,7 +212,7 @@ where
for op in &self.ops {
match &op {
DeltaOperation::Retain(retain) => {
for c in code_point_iter.take(retain.n as usize) {
for c in code_point_iter.take(retain.n) {
new_s.push_str(str::from_utf8(c.0).unwrap_or(""));
}
},
@ -274,8 +274,7 @@ where
},
DeltaOperation::Delete(delete) => {
let bytes = code_point_iter
.take(*delete as usize)
.into_iter()
.take(*delete)
.flat_map(|a| str::from_utf8(a.0).ok())
.collect::<String>();
@ -500,7 +499,7 @@ where
let mut inverted = DeltaOperations::default();
let mut index = 0;
for op in &self.ops {
let len: usize = op.len() as usize;
let len: usize = op.len();
match op {
DeltaOperation::Delete(n) => {
invert_other(&mut inverted, other, op, index, index + *n);
@ -512,14 +511,14 @@ where
false => {
// tracing::trace!("invert retain: {} by retain {} {}", op, len,
// op.get_attributes());
inverted.retain(len as usize, op.get_attributes())
inverted.retain(len, op.get_attributes())
},
}
index += len;
},
DeltaOperation::Insert(_) => {
// tracing::trace!("invert insert: {} by delete {}", op, len);
inverted.delete(len as usize);
inverted.delete(len);
},
}
}

View File

@ -120,18 +120,13 @@ impl NodeDataBuilder {
/// The NodeBody implements the [`OperationTransform`] trait which means it can perform
/// compose, transform and invert.
///
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum Body {
#[default]
Empty,
Delta(DeltaTextOperations),
}
impl std::default::Default for Body {
fn default() -> Self {
Body::Empty
}
}
impl Body {
fn is_empty(&self) -> bool {
matches!(self, Body::Empty)

View File

@ -94,8 +94,9 @@ impl Transaction {
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub enum Extension {
#[default]
Empty,
TextSelection {
before_selection: Selection,
@ -103,12 +104,6 @@ pub enum Extension {
},
}
impl std::default::Default for Extension {
fn default() -> Self {
Extension::Empty
}
}
impl Extension {
fn is_empty(&self) -> bool {
matches!(self, Extension::Empty)

View File

@ -53,18 +53,14 @@ where
#[derive(Debug, Clone, Serialize_repr, Deserialize_repr, Display, PartialEq, Eq)]
#[repr(u8)]
#[derive(Default)]
pub enum ErrorCode {
#[default]
InternalError = 0,
UnsupportedMessage = 1,
Unauthorized = 2,
}
impl std::default::Default for ErrorCode {
fn default() -> Self {
ErrorCode::InternalError
}
}
impl std::convert::From<url::ParseError> for WSError {
fn from(error: ParseError) -> Self {
WSError::internal().context(error)

View File

@ -21,18 +21,14 @@ impl WebSocketRawMessage {
// The lib-ws crate should not contain business logic.So WSChannel should be removed into another place.
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Eq, PartialEq, Hash)]
#[repr(u8)]
#[derive(Default)]
pub enum WSChannel {
#[default]
Document = 0,
Folder = 1,
Database = 2,
}
impl std::default::Default for WSChannel {
fn default() -> Self {
WSChannel::Document
}
}
impl ToString for WSChannel {
fn to_string(&self) -> String {
match self {

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.65"
channel = "1.70"