Skip to content

Commit d4946f1

Browse files
authored
chore: cell data operation (#1656)
* chore: get all cells for specific field * chore: auto format clippy wanrings * chore: get cells for specific field type
1 parent 7949d3f commit d4946f1

File tree

94 files changed

+673
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+673
-609
lines changed

frontend/rust-lib/dart-notify/src/entities/subject.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ pub struct SubscribeObject {
2121

2222
impl std::fmt::Display for SubscribeObject {
2323
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
24-
let _ = f.write_str(&format!("{} changed: ", &self.source))?;
24+
f.write_str(&format!("{} changed: ", &self.source))?;
2525
if let Some(payload) = &self.payload {
26-
let _ = f.write_str(&format!("send {} payload", payload.len()))?;
26+
f.write_str(&format!("send {} payload", payload.len()))?;
2727
}
2828

2929
if let Some(payload) = &self.error {
30-
let _ = f.write_str(&format!("receive {} error", payload.len()))?;
30+
f.write_str(&format!("receive {} error", payload.len()))?;
3131
}
3232

3333
Ok(())

frontend/rust-lib/flowy-database/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn init(storage_path: &str) -> Result<Database, io::Error> {
3535
let pool_config = PoolConfig::default();
3636
let database = Database::new(storage_path, DB_NAME, pool_config).map_err(as_io_error)?;
3737
let conn = database.get_connection().map_err(as_io_error)?;
38-
let _ = embedded_migrations::run(&*conn).map_err(as_io_error)?;
38+
embedded_migrations::run(&*conn).map_err(as_io_error)?;
3939
Ok(database)
4040
}
4141

frontend/rust-lib/flowy-derive/src/proto_buf/util.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ pub fn category_from_str(type_str: String) -> TypeCategory {
6363
let cache: ProtoCache = serde_json::from_str(&s).unwrap();
6464
CACHE_INFO
6565
.entry(TypeCategory::Protobuf)
66-
.or_insert(vec![])
66+
.or_default()
6767
.extend(cache.structs);
68-
CACHE_INFO
69-
.entry(TypeCategory::Enum)
70-
.or_insert(vec![])
71-
.extend(cache.enums);
68+
CACHE_INFO.entry(TypeCategory::Enum).or_default().extend(cache.enums);
7269
}
7370
}
7471
}

frontend/rust-lib/flowy-document/src/editor/document.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl RevisionObjectDeserializer for DocumentRevisionSerde {
8282
fn deserialize_revisions(_object_id: &str, revisions: Vec<Revision>) -> FlowyResult<Self::Output> {
8383
let mut tree = NodeTree::new(make_tree_context());
8484
let transaction = make_transaction_from_revisions(&revisions)?;
85-
let _ = tree.apply_transaction(transaction)?;
85+
tree.apply_transaction(transaction)?;
8686
let document = Document::new(tree);
8787
Result::<Document, FlowyError>::Ok(document)
8888
}
@@ -106,7 +106,7 @@ impl RevisionMergeable for DocumentRevisionMergeable {
106106
pub fn make_transaction_from_revisions(revisions: &[Revision]) -> FlowyResult<Transaction> {
107107
let mut transaction = Transaction::new();
108108
for revision in revisions {
109-
let _ = transaction.compose(Transaction::from_bytes(&revision.bytes)?)?;
109+
transaction.compose(Transaction::from_bytes(&revision.bytes)?)?;
110110
}
111111
Ok(transaction)
112112
}

frontend/rust-lib/flowy-document/src/editor/document_serde.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ impl Serialize for Document {
1717
S: Serializer,
1818
{
1919
let mut map = serializer.serialize_map(Some(1))?;
20-
let _ = map.serialize_key("document")?;
21-
let _ = map.serialize_value(&DocumentContentSerializer(self))?;
20+
map.serialize_key("document")?;
21+
map.serialize_value(&DocumentContentSerializer(self))?;
2222
map.end()
2323
}
2424
}
@@ -312,7 +312,7 @@ impl<'a> Serialize for DocumentContentSerializer<'a> {
312312
let mut seq = serializer.serialize_seq(Some(children.len()))?;
313313
for child in children {
314314
if let Some(node_data) = get_document_node_data(child) {
315-
let _ = seq.serialize_element(&node_data)?;
315+
seq.serialize_element(&node_data)?;
316316
}
317317
}
318318
seq.end()

frontend/rust-lib/flowy-document/src/editor/editor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl AppFlowyDocumentEditor {
5050
.command_sender
5151
.send(Command::ComposeTransaction { transaction, ret })
5252
.await;
53-
let _ = rx.await.map_err(internal_error)??;
53+
rx.await.map_err(internal_error)??;
5454
Ok(())
5555
}
5656

@@ -115,7 +115,7 @@ impl DocumentEditor for Arc<AppFlowyDocumentEditor> {
115115
let this = self.clone();
116116
FutureResult::new(async move {
117117
let transaction = DocumentTransaction::from_bytes(data)?;
118-
let _ = this.apply_transaction(transaction.into()).await?;
118+
this.apply_transaction(transaction.into()).await?;
119119
Ok(())
120120
})
121121
}

frontend/rust-lib/flowy-document/src/entities.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::errors::ErrorCode;
22
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
33
use std::convert::TryInto;
44

5-
#[derive(PartialEq, Debug, ProtoBuf_Enum, Clone)]
5+
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
66
pub enum ExportType {
77
Text = 0,
88
Markdown = 1,
@@ -79,7 +79,7 @@ pub struct ExportPayloadPB {
7979
pub document_version: DocumentVersionPB,
8080
}
8181

82-
#[derive(PartialEq, Debug, ProtoBuf_Enum, Clone)]
82+
#[derive(PartialEq, Eq, Debug, ProtoBuf_Enum, Clone)]
8383
pub enum DocumentVersionPB {
8484
/// this version's content of the document is build from `Delta`. It uses
8585
/// `DeltaDocumentEditor`.

frontend/rust-lib/flowy-document/src/event_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) async fn apply_edit_handler(
2626
manager: AFPluginState<Arc<DocumentManager>>,
2727
) -> Result<(), FlowyError> {
2828
let params: EditParams = data.into_inner().try_into()?;
29-
let _ = manager.apply_edit(params).await?;
29+
manager.apply_edit(params).await?;
3030
Ok(())
3131
}
3232

frontend/rust-lib/flowy-document/src/manager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl DocumentManager {
109109
/// Called immediately after the application launched with the user sign in/sign up.
110110
#[tracing::instrument(level = "trace", skip_all, err)]
111111
pub async fn initialize(&self, user_id: &str) -> FlowyResult<()> {
112-
let _ = self.persistence.initialize(user_id)?;
112+
self.persistence.initialize(user_id)?;
113113
listen_ws_state_changed(self.rev_web_socket.clone(), self.editor_map.clone());
114114
Ok(())
115115
}
@@ -138,7 +138,7 @@ impl DocumentManager {
138138

139139
pub async fn apply_edit(&self, params: EditParams) -> FlowyResult<()> {
140140
let editor = self.get_document_editor(&params.doc_id).await?;
141-
let _ = editor.compose_local_operations(Bytes::from(params.operations)).await?;
141+
editor.compose_local_operations(Bytes::from(params.operations)).await?;
142142
Ok(())
143143
}
144144

@@ -147,7 +147,7 @@ impl DocumentManager {
147147
let db_pool = self.persistence.database.db_pool()?;
148148
// Maybe we could save the document to disk without creating the RevisionManager
149149
let rev_manager = self.make_rev_manager(&doc_id, db_pool)?;
150-
let _ = rev_manager.reset_object(revisions).await?;
150+
rev_manager.reset_object(revisions).await?;
151151
Ok(())
152152
}
153153

frontend/rust-lib/flowy-document/src/old_editor/editor.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ impl DeltaDocumentEditor {
7979
ret,
8080
};
8181
let _ = self.edit_cmd_tx.send(msg).await;
82-
let _ = rx.await.map_err(internal_error)??;
82+
rx.await.map_err(internal_error)??;
8383
Ok(())
8484
}
8585

8686
pub async fn delete(&self, interval: Interval) -> Result<(), FlowyError> {
8787
let (ret, rx) = oneshot::channel::<CollaborateResult<()>>();
8888
let msg = EditorCommand::Delete { interval, ret };
8989
let _ = self.edit_cmd_tx.send(msg).await;
90-
let _ = rx.await.map_err(internal_error)??;
90+
rx.await.map_err(internal_error)??;
9191
Ok(())
9292
}
9393

@@ -99,7 +99,7 @@ impl DeltaDocumentEditor {
9999
ret,
100100
};
101101
let _ = self.edit_cmd_tx.send(msg).await;
102-
let _ = rx.await.map_err(internal_error)??;
102+
rx.await.map_err(internal_error)??;
103103
Ok(())
104104
}
105105

@@ -111,7 +111,7 @@ impl DeltaDocumentEditor {
111111
ret,
112112
};
113113
let _ = self.edit_cmd_tx.send(msg).await;
114-
let _ = rx.await.map_err(internal_error)??;
114+
rx.await.map_err(internal_error)??;
115115
Ok(())
116116
}
117117

@@ -133,15 +133,15 @@ impl DeltaDocumentEditor {
133133
let (ret, rx) = oneshot::channel();
134134
let msg = EditorCommand::Undo { ret };
135135
let _ = self.edit_cmd_tx.send(msg).await;
136-
let _ = rx.await.map_err(internal_error)??;
136+
rx.await.map_err(internal_error)??;
137137
Ok(())
138138
}
139139

140140
pub async fn redo(&self) -> Result<(), FlowyError> {
141141
let (ret, rx) = oneshot::channel();
142142
let msg = EditorCommand::Redo { ret };
143143
let _ = self.edit_cmd_tx.send(msg).await;
144-
let _ = rx.await.map_err(internal_error)??;
144+
rx.await.map_err(internal_error)??;
145145
Ok(())
146146
}
147147
}
@@ -193,7 +193,7 @@ impl DocumentEditor for Arc<DeltaDocumentEditor> {
193193
let msg = EditorCommand::ComposeLocalOperations { operations, ret };
194194

195195
let _ = edit_cmd_tx.send(msg).await;
196-
let _ = rx.await.map_err(internal_error)??;
196+
rx.await.map_err(internal_error)??;
197197
Ok(())
198198
})
199199
}

0 commit comments

Comments
 (0)