-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[unstable option] blank_lines_lower_bound #3382
Comments
It would be more useful if statements inside functions are not covered by this, only declarations! Or is there another way to specify that I want to have at least 1 empty line between declarations (also between function-local declarations and whatever comes before/after)? (But not between statements in a function body.) Example const A: u32 = 1;
enum B {
C
}
impl B {
// ...
} Set to 1: const A: u32 = 1;
enum B {
C
}
impl B {
// ...
} |
What are the issues blocking the stabilisation of this option? |
@arzg - The process and requirements for stabilizing a configuration option are described here. Specifically, there are several issues that exist with Some fixes/improvements to
|
With impl A {
fn a() { /* ... */ }
fn b() { /* ... */ }
} will get formatted to impl A {
fn a() { /* ... */ }
fn b() { /* ... */ }
} Is this correct? I.e., should this case be covered by this configuration option? |
It would be nice to have slightly more finegrained control with this option, in particular, I would like to allow items which fit on a single line to have a |
This option doesn't seem to have a useful behaviour at the moment, is it something that will be tweaked? My expectation would be that items (functions, struct definitions, similar) are separated by the lines (the documentation says items). What actually happens is that attributes are spaced with one line before their functions, statements by one line etc, doc comments by one line before their functions etc. (Using @@ -1460,6 +1490,7 @@ impl<A> Clone for OwnedArcRepr<A> {
/// [`RawArrayView`](type.RawArrayView.html) /
/// [`RawArrayViewMut`](type.RawArrayViewMut.html) for the array type!*
#[derive(Copy, Clone)]
+
// This is just a marker type, to carry the mutability and element type.
pub struct RawViewRepr<A> {
ptr: PhantomData<A>,
@@ -1467,7 +1498,9 @@ pub struct RawViewRepr<A> {
impl<A> RawViewRepr<A> {
#[inline(always)]
+
fn new() -> Self {
+
RawViewRepr { ptr: PhantomData }
}
}
@@ -1620,6 +1686,8 @@ mod impl_raw_views;
mod impl_cow;
/// Returns `true` if the pointer is aligned.
+
pub(crate) fn is_aligned<T>(ptr: *const T) -> bool {
+
(ptr as usize) % ::std::mem::align_of::<T>() == 0
} |
Hello, would it be possible to please get a update on the status of this being stabilized? Thank you very much. |
When
I am still experiencing this bug. |
@dcow I'd suggest that you open up a new issue to fully describe the problem that you're experiencing |
I just finished reading the saga over here about newlines between definitions etc., and then found the implementation and ultimately this tracking issue. It seems like originally the consensus was to allow for configurability in whitespace between both statements and items. I understand this to mean configuration for statements, and configuration for items. But the implementation currently provides one option for both statements and items. As @bluss pointed out above, this is not particularly useful behavior. I would say it is pretty common that teams want blank newlines between function definitions, but uncommon that teams want blank newlines between every single statement in a function. I don't see any discussion between the issue I linked above and the implementation, though, so I'm not sure how this new merged-configuration implementation was decided upon. Is there any other discussion I am missing, perhaps? Also, thanks for all the work up until this point. Obviously the tool is great and I'm happy that the discussion has made it this far. I am just seeking clarity on what happened, and if it is still planned to add configurability for spaces between definitions. |
Yes, that would be preferrable, as some functions signature becomes readable when a new blank line within the function body exists. |
I am new to Rust world. The fact that it's over 5 years since issue was raised. I am thinking this project has been abandoned? |
Welcome 👋
No, and I'd suggest that using the amount of time that has passed since any given issue was opened as a measure for whether a project is active vs. abandoned is not going to lead to accurate results. I don't think there's any singular way to adequately gauge a project's health, but I think some better indicators would be things like whether maintainers are responding, whether there are some issues being opened/triaged/closed, (in some cases) whether there's still code changes being made, bugs being fixed/features being added, etc. I'd posit that if you go look at most large-scale projects on GitHub you'll find they have open issues that are much, much older than 5 years! |
Tracking issue for blank_lines_lower_bound
The text was updated successfully, but these errors were encountered: