Skip to content
  • Mitchell Kember's avatar
    74efb755345d
    rust: reformat max width · 74efb755345d
    Mitchell Kember authored
    Generated by changing rustfmt.toml as follows and running `cargo +nightly fmt`:
    
        max_width = 80                       # previously 79
        use_small_heuristics = "Max"         # previously "Default"
        single_line_if_else_max_width = 50   # previously 50% of 79 = 39
        single_line_let_else_max_width = 50  # previously 50% of 79 = 39
    
    This is net -825 LOC. For context, we have about 45K non-blank lines of Rust.
    
    This changes max_width from 79 to 80 to be the same as Python (see project.toml,
    .flake8, and contrib/pylintrc), and adds use_small_heuristics = "Max". The
    default "small heuristics" make rustfmt use a smaller max_width for many
    constructs, e.g. struct literals can only be 18% of max_width before wrapping.
    This leads to aggressive line wrapping, especially as our max_width is down from
    the default of 100. With "Max", wrapping only occurs after 100% of max_width.
    The one change to "Max" we make is to restrict single-line if-else expressions
    to 50 characters rather than the full 80.
    
    For more details see:
    https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#use_small_heuristics
    
    # skip-blame mass-reformating only
    74efb755345d
    rust: reformat max width
    Mitchell Kember authored
    Generated by changing rustfmt.toml as follows and running `cargo +nightly fmt`:
    
        max_width = 80                       # previously 79
        use_small_heuristics = "Max"         # previously "Default"
        single_line_if_else_max_width = 50   # previously 50% of 79 = 39
        single_line_let_else_max_width = 50  # previously 50% of 79 = 39
    
    This is net -825 LOC. For context, we have about 45K non-blank lines of Rust.
    
    This changes max_width from 79 to 80 to be the same as Python (see project.toml,
    .flake8, and contrib/pylintrc), and adds use_small_heuristics = "Max". The
    default "small heuristics" make rustfmt use a smaller max_width for many
    constructs, e.g. struct literals can only be 18% of max_width before wrapping.
    This leads to aggressive line wrapping, especially as our max_width is down from
    the default of 100. With "Max", wrapping only occurs after 100% of max_width.
    The one change to "Max" we make is to restrict single-line if-else expressions
    to 50 characters rather than the full 80.
    
    For more details see:
    https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#use_small_heuristics
    
    # skip-blame mass-reformating only
Loading