Need feedbacks on a project that I built recently

SO I built a chat application that let's you talk in specific rooms in terminal itself

The idea is to make it easier to create room and talk in that room, without having to go to any external app

Here's the code:

Hi there,

Below my comments.

(note: I am relative new to Rust and this is my first review on this forum. So double check and veriify/expiriment ! :grinning_face: )

  • Clippy is a great friend! - type cargo clippy and solve all the issues (8x) presented.
  • I would suggest using workspaces (see: cargo workspaces) at least you have only one list of dependencies to maintain. Keeping the client and server in sync.
  • Its a convention to put the directory tests at the same level as src ( See rust project layout)
  • Halve of your tests are failing, all are related to : called Result::unwrap() on an Err value: ServerError("Couldn't return") . You can use a match (or if let) statement to deal with the error case ( for more detail see: handling the Result type)
  • As far as i can see is the "terminal-client" a CLI application. If thats the case , get rid of the lib.rs file. Otherwhise make it clear in the documentation.
  • You are defining your own colors, may be you can use crate p.e. colored to get rid of the boilerplate.

Checkout Idiomatic Rust , gives a lot of usefull information

1 Like

To add to the other response, I think egui is a pretty good example of a multi-crate project using Clippy, a workspace (with a bunch of workspace-level lint settings and dependency versions), and a crates folder for all the crates in the project. At least, the structure of egui (and another codebase, I forget which) is what I based my first few multi-crate projects on.

1 Like