Coder Social home page Coder Social logo

Comments (5)

hug-dev avatar hug-dev commented on July 17, 2024 1

All of our operation structures (example: OpPing) are declared in their src/operations/... (example: ping.rs) file.
Clippy, with the pedantic lint group enabled complains about that as it is a duplication of name:

error: item name ends with its containing module's name
  --> src/operations/ping.rs:18:1
   |
18 | pub struct OpPing;
   | ^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::module-name-repetitions` implied by `-D clippy::pedantic`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

error: item name ends with its containing module's name
  --> src/operations/ping.rs:26:1
   |
26 | / pub struct ResultPing {
27 | |     pub supp_version_maj: u8,
28 | |     pub supp_version_min: u8,
29 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

The absolute name of the structure is operations::ping::OpPing but using namespacing we could rename this structure to be Operation only and so its absolute name would be operations::ping::Operation
In context where we need to use all the OpXXX or all the ResultXXX, we can import operations::{ping, etc} and use the different ones with ping::Operation, ping::Result, etc...

What are you thoughts about that?

from parsec.

ionut-arm avatar ionut-arm commented on July 17, 2024 1

That sounds good! We could eiither use ping::Operation or simply re-export them with an alias at the root of the library, i.e. pub use ...::ping::Operation as OpPing

from parsec.

hug-dev avatar hug-dev commented on July 17, 2024

The same should be done in our other crates.

from parsec.

hug-dev avatar hug-dev commented on July 17, 2024

Following the same logic we should also rename all of our Protobuf operations to remove the PingProto from OpPingProto and ResultPingProto (and all of them) as it will be namespaced correctly (to be checked in other languages, like C).
Otherwise we have the same issue:

use super::generated_ops::ping::{OpPingProto, ResultPingProto};

which seems a bit weird if we do not fix as well.
That would incur a lot of changes to leaving that issue for now.

from parsec.

hug-dev avatar hug-dev commented on July 17, 2024

I will for now add cargo clippy --all-targets --all-features -- -D clippy::all -D clippy::cargo to our CIs and create a new issue (out of the 1.0.0 milestone) to add the pedantic one.

from parsec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.