chore: rustfmt & editorconfig

This commit is contained in:
zaaarf 2024-03-09 19:07:23 +01:00
parent 5ecd52d237
commit 4347dfa9d7
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
9 changed files with 60 additions and 34 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# Default to Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
[*.rs]
indent_size = 2
[*.proto]
indent_size = 2
[*.js]
indent_size = 2
[*.{yml,yaml}]
indent_style = space
indent_size = 2

1
.rustfmt.toml Normal file
View file

@ -0,0 +1 @@
hard_tabs = true

View file

@ -1,6 +1,5 @@
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure() Ok(tonic_build::configure().compile(
.compile(
&[ &[
"proto/common.proto", "proto/common.proto",
"proto/cursor.proto", "proto/cursor.proto",
@ -10,6 +9,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/buffer.proto", "proto/buffer.proto",
], ],
&["proto"], &["proto"],
)?; )?)
Ok(())
} }

View file

@ -2,7 +2,6 @@ syntax = "proto2";
package common; package common;
// a wrapper payload representing an uuid // a wrapper payload representing an uuid
message Identity { message Identity {
// uuid bytes, as string // uuid bytes, as string

View file

@ -10,7 +10,6 @@ service Cursor {
rpc Attach (stream cursor.CursorPosition) returns (stream cursor.CursorEvent); rpc Attach (stream cursor.CursorPosition) returns (stream cursor.CursorEvent);
} }
// a tuple indicating row and column // a tuple indicating row and column
message RowCol { message RowCol {
required int32 row = 1; required int32 row = 1;

View file

@ -28,7 +28,6 @@ pub mod proto {
} }
} }
pub mod files { pub mod files {
tonic::include_proto!("files"); tonic::include_proto!("files");
@ -40,7 +39,9 @@ pub mod proto {
impl From<&str> for BufferNode { impl From<&str> for BufferNode {
fn from(value: &str) -> Self { fn from(value: &str) -> Self {
BufferNode { path: value.to_string() } BufferNode {
path: value.to_string(),
}
} }
} }
@ -51,8 +52,16 @@ pub mod proto {
} }
} }
pub mod buffer { tonic::include_proto!("buffer"); } pub mod buffer {
pub mod cursor { tonic::include_proto!("cursor"); } tonic::include_proto!("buffer");
pub mod workspace { tonic::include_proto!("workspace"); } }
pub mod auth { tonic::include_proto!("auth"); } pub mod cursor {
tonic::include_proto!("cursor");
}
pub mod workspace {
tonic::include_proto!("workspace");
}
pub mod auth {
tonic::include_proto!("auth");
}
} }