Skip to content

Commit a328e4e

Browse files
authored
Don't allocate a Vec for non_null_positions (#746)
1 parent 37b0cf2 commit a328e4e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

librubyfmt/src/format_prism.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,8 +4728,8 @@ fn handle_string_at_offset<'src>(ps: &mut ParserState<'src>, ident: &'src str, o
47284728
ps.emit_ident(ident);
47294729
}
47304730

4731-
fn non_null_positions<'src>(params: &prism::ParametersNode<'src>) -> Vec<bool> {
4732-
vec![
4731+
fn non_null_positions<'src>(params: &prism::ParametersNode<'src>) -> [bool; 7] {
4732+
[
47334733
!params.requireds().is_empty(),
47344734
!params.optionals().is_empty(),
47354735
params.rest().is_some(),

librubyfmt/src/ripper_tree_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ def_tag!(args_forward_tag, "args_forward");
12641264
pub struct ArgsForward(pub args_forward_tag, pub StartEnd);
12651265

12661266
impl Params {
1267-
pub fn non_null_positions(&self) -> Vec<bool> {
1268-
vec![
1267+
pub fn non_null_positions(&self) -> [bool; 7] {
1268+
[
12691269
(self.1).is_some(),
12701270
(self.2).is_some(),
12711271
(self.3).is_some(),

0 commit comments

Comments
 (0)