Skip to content

Comments wrapped at 99 chars instead of 101. #4929

Closed
@jnqnfe

Description

@jnqnfe

With the following config:

brace_style = "SameLineWhere"
comment_width = 100
control_brace_style = "ClosingNextLine"
edition = "2018"
fn_args_layout = "Compressed"
hard_tabs = false
match_block_trailing_comma = true
max_width = 100
merge_derives = false
newline_style = "Unix"
normalize_doc_attributes = true
overflow_delimited_expr = true
reorder_imports = false
group_imports = "StdExternalCrate"
reorder_modules = true
#struct_field_align_threshold = 20
tab_spaces = 4
trailing_comma = "Never"
use_small_heuristics = "Max"
use_try_shorthand = true
#where_single_line = true
wrap_comments = true

The following change was made:

 /* Note, we cannot simply use the object defined in the ‘sys’ crate, since either the type or the
- * trait need to be defined locally in order to link them. Thus, we create the below type (an empty
- * one, just used as an opaque pointer), and transmute to the ‘sys’ crate one.
+ * trait need to be defined locally in order to link them. Thus, we create the below type (an
+ * empty one, just used as an opaque pointer), and transmute to the ‘sys’ crate one.
  */

The longest line was 99 chars, so wrapping should not have occurred here.

This is also a problem for other styles of comments:

     /// Maximum length of the buffer in bytes.
     ///
-    /// Setting this to [`std::u32::MAX`] will initialize this to the maximum value supported by the
-    /// server, which is recommended. In strict low-latency playback scenarios you might want to set
-    /// this to a lower value, likely together with the [`stream::FlagSet::ADJUST_LATENCY`] flag. If
-    /// you do so, you ensure that the latency doesn’t grow beyond what is acceptable for the use
-    /// case, at the cost of getting more underruns if the latency is lower than what the server can
-    /// reliably handle.
+    /// Setting this to [`std::u32::MAX`] will initialize this to the maximum value supported by
+    /// the server, which is recommended. In strict low-latency playback scenarios you might
+    /// want to set this to a lower value, likely together with the
+    /// [`stream::FlagSet::ADJUST_LATENCY`] flag. If you do so, you ensure that the latency
+    /// doesn’t grow beyond what is acceptable for the use case, at the cost of getting more
+    /// underruns if the latency is lower than what the server can reliably handle.
     ///
     /// [`stream::FlagSet::ADJUST_LATENCY`]: crate::stream::FlagSet::ADJUST_LATENCY
     pub maxlength: u32,

With the longest lines here being exactly 100 chars, no wrapping should have occurred.

Version string: rustfmt 1.4.37-stable (a178d03 2021-07-26)
Project: https://github.com/jnqnfe/pulse-binding-rust
Ran against the master branch after adding the quoted config.

The Specific projects files are https://github.com/jnqnfe/pulse-binding-rust/blob/master/pulse-binding-mainloop-glib/src/lib.rs for the first instance and https://github.com/jnqnfe/pulse-binding-rust/blob/master/pulse-binding/src/def.rs for the second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions