Comments (7)
Sure. Do you think you could play with rustfmt's options to get an output very close to the current one? Then I'll merge that and reformat the rest.
from smoltcp.
I ll give it a try. I think the main difference is the alignment - i.e. this is what is in smoltcp now:
/// Return the header length.
/// The result depends on the value of the message type field.
pub fn header_len(&self) -> usize {
match self.msg_type() {
Message::EchoRequest => field::ECHO_SEQNO.end,
Message::EchoReply => field::ECHO_SEQNO.end,
Message::DstUnreachable => field::UNUSED.end,
_ => field::CHECKSUM.end // make a conservative assumption
}
}
And this is after rustfmt
with default settings:
/// Return the header length.
/// The result depends on the value of the message type field.
pub fn header_len(&self) -> usize {
match self.msg_type() {
Message::EchoRequest => field::ECHO_SEQNO.end,
Message::EchoReply => field::ECHO_SEQNO.end,
Message::DstUnreachable => field::UNUSED.end,
_ => field::CHECKSUM.end, // make a conservative assumption
}
}
So I am not sure how much you care about the right alignment?
from smoltcp.
To be honest I find that it helps readability a lot.
from smoltcp.
After poking around it looks like there is no setting for rustfmt that would keep the LHS => RHS alignment as you have it. Apparently it is a discouraged style for Rust.
So the question is - do you prefer to keep your current formatting even though it means no automatic format checking, or do you want to switch to the format mentioned above?
from smoltcp.
Let's keep it, but just so that your work doesn't go nowhere, please post your rustfmt config here. If we ever switch to using rustfmt I'll make use of it.
from smoltcp.
OK. Place rustfmt.toml
in the root dir of the project.
The contents are simple and can be further tuned:
attributes_on_same_line_as_field = false
attributes_on_same_line_as_variant = false
struct_field_align_threshold = 20
tab_spaces = 4
See https://github.com/rust-lang-nursery/rustfmt for details
from smoltcp.
I looked at the diff produced by rustfmt. It is 11937 line long and readability suffers, particularly badly with tests. Thank you for your work but I don't think I'm going to use rustfmt for my projects.
from smoltcp.
Related Issues (20)
- dns Question type not exported HOT 1
- Significant drop of bandwidth in presence of link delay HOT 2
- Bug in IPv6 source address selection (#864) prevents sending packets to localhost to localhost HOT 1
- `Ipv6Packet::scope` and `Scope` is private HOT 1
- How to make IPv6 handle any ip HOT 2
- UDP: Read and set local address on unbound sockets (IPV6_PKTINFO style functionality) HOT 4
- Use of `fugit` instead of custom time implementation. HOT 2
- run server example panics HOT 2
- Expose a C-API for legacy bare-metal systems
- Proposal: Improve the routing table by radix tree HOT 1
- feature request: impl AsFd for {RawSocket, TunTapInterface}
- How can I get neighbour cache from `Interface`? HOT 5
- UDP: setsockopt REUSEADDR suport, when we run process_udp HOT 2
- Poor performance of SocketSet::add HOT 2
- [Feature Request] Resize TCP socket buffer dynamically after TCP socket has been created HOT 5
- Return error instead of panicking HOT 1
- Ergonomics of `Interface::new` device parameter HOT 4
- Connecting a Raw socket and a TCP socket HOT 4
- Track defmt issue #833 HOT 1
- Smoltcp panics in `get_source_address_ipv6` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smoltcp.