Skip to content

feat: implement std.flattenDeepArray builtin #464

feat: implement std.flattenDeepArray builtin

feat: implement std.flattenDeepArray builtin #464

GitHub Actions / clippy succeeded Apr 7, 2024 in 1s

clippy

129 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 129
Note 0
Help 0

Versions

  • rustc 1.75.0-nightly (2f1bd0729 2023-10-27)
  • cargo 1.75.0-nightly (df3509237 2023-10-24)
  • clippy 0.1.75 (2f1bd07 2023-10-27)

Annotations

Check warning on line 156 in cmds/jrsonnet/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> cmds/jrsonnet/src/main.rs:156:4
    |
156 |             eprintln!("{out}")
    |             ^^^^^^^^^^^^^^^^^^ help: add a `;` here: `eprintln!("{out}");`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
    = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]`

Check warning on line 105 in crates/jrsonnet-cli/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> crates/jrsonnet-cli/src/lib.rs:105:3
    |
105 |         eprintln!("Tracked: {}", jrsonnet_gcmodule::count_thread_tracked())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `eprintln!("Tracked: {}", jrsonnet_gcmodule::count_thread_tracked());`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 91 in crates/jrsonnet-cli/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

warning: redundant closure
  --> crates/jrsonnet-cli/src/lib.rs:91:28
   |
91 |         with_thread_object_space(|s| s.leak())
   |                                  ^^^^^^^^^^^^ help: replace the closure with the method itself: `jrsonnet_gcmodule::ObjectSpace::leak`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
   = note: `-W clippy::redundant-closure-for-method-calls` implied by `-W clippy::pedantic`
   = help: to override `-W clippy::pedantic` add `#[allow(clippy::redundant_closure_for_method_calls)]`

Check warning on line 91 in crates/jrsonnet-cli/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
  --> crates/jrsonnet-cli/src/lib.rs:91:3
   |
91 |         with_thread_object_space(|s| s.leak())
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `with_thread_object_space(|s| s.leak());`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
   = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic`
   = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]`

Check warning on line 121 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

it is more concise to loop over references to containers instead of using explicit iteration methods

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> crates/jrsonnet-cli/src/stdlib.rs:121:14
    |
121 |         for ext in self.ext_code_file.iter() {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&self.ext_code_file`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop

Check warning on line 118 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

it is more concise to loop over references to containers instead of using explicit iteration methods

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> crates/jrsonnet-cli/src/stdlib.rs:118:14
    |
118 |         for ext in self.ext_code.iter() {
    |                    ^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&self.ext_code`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop

Check warning on line 115 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

it is more concise to loop over references to containers instead of using explicit iteration methods

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> crates/jrsonnet-cli/src/stdlib.rs:115:14
    |
115 |         for ext in self.ext_str_file.iter() {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&self.ext_str_file`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop

Check warning on line 112 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

it is more concise to loop over references to containers instead of using explicit iteration methods

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> crates/jrsonnet-cli/src/stdlib.rs:112:14
    |
112 |         for ext in self.ext_str.iter() {
    |                    ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&self.ext_str`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
    = note: `-W clippy::explicit-iter-loop` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::explicit_iter_loop)]`

Check warning on line 46 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary structure name repetition

warning: unnecessary structure name repetition
  --> crates/jrsonnet-cli/src/stdlib.rs:46:15
   |
46 |             None => Ok(ExtStr {
   |                        ^^^^^^ help: use the applicable keyword: `Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self

Check warning on line 42 in crates/jrsonnet-cli/src/stdlib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary structure name repetition

warning: unnecessary structure name repetition
  --> crates/jrsonnet-cli/src/stdlib.rs:42:20
   |
42 |             Some(idx) => Ok(ExtStr {
   |                             ^^^^^^ help: use the applicable keyword: `Self`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
   = note: `-W clippy::use-self` implied by `-W clippy::nursery`
   = help: to override `-W clippy::nursery` add `#[allow(clippy::use_self)]`

Check warning on line 329 in crates/jrsonnet-stdlib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used binding `_s` which is prefixed with an underscore. A leading underscore signals that a binding will not be used

warning: used binding `_s` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
   --> crates/jrsonnet-stdlib/src/lib.rs:329:53
    |
329 |                 let mut context = ContextBuilder::with_capacity(_s, 1);
    |                                                                 ^^
    |
note: `_s` is defined here
   --> crates/jrsonnet-stdlib/src/lib.rs:315:13
    |
315 |     pub fn new(_s: State, resolver: PathResolver) -> Self {
    |                ^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
    = note: `-W clippy::used-underscore-binding` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::used_underscore_binding)]`

Check warning on line 318 in crates/jrsonnet-stdlib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

calling `HashMap::default()` is more clear than this expression

warning: calling `HashMap::default()` is more clear than this expression
   --> crates/jrsonnet-stdlib/src/lib.rs:318:17
    |
318 |             ext_natives: Default::default(),
    |                          ^^^^^^^^^^^^^^^^^^ help: try: `HashMap::default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access

Check warning on line 317 in crates/jrsonnet-stdlib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

calling `HashMap::default()` is more clear than this expression

warning: calling `HashMap::default()` is more clear than this expression
   --> crates/jrsonnet-stdlib/src/lib.rs:317:14
    |
317 |             ext_vars: Default::default(),
    |                       ^^^^^^^^^^^^^^^^^^ help: try: `HashMap::default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
    = note: `-W clippy::default-trait-access` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::default_trait_access)]`

Check warning on line 74 in crates/jrsonnet-stdlib/src/misc.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use Option::map_or_else instead of an if let/else

warning: use Option::map_or_else instead of an if let/else
  --> crates/jrsonnet-stdlib/src/misc.rs:70:2
   |
70 | /     if let Some(rest) = rest {
71 | |         rest.evaluate()
72 | |     } else {
73 | |         Ok(str)
74 | |     }
   | |_____^ help: try: `rest.map_or_else(|| Ok(str), |rest| rest.evaluate())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else

Check warning on line 151 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u32` to `f64` may become silently lossy if you later change the type

warning: casting `u32` to `f64` may become silently lossy if you later change the type
   --> crates/jrsonnet-stdlib/src/strings.rs:151:26
    |
151 |             Ok(base * aggregate + digit as f64)
    |                                   ^^^^^^^^^^^^ help: try: `f64::from(digit)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless

Check warning on line 151 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

multiply and add expressions can be calculated more efficiently and accurately

warning: multiply and add expressions can be calculated more efficiently and accurately
   --> crates/jrsonnet-stdlib/src/strings.rs:151:7
    |
151 |             Ok(base * aggregate + digit as f64)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `base.mul_add(aggregate, digit as f64)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suboptimal_flops
    = note: `-W clippy::suboptimal-flops` implied by `-W clippy::nursery`
    = help: to override `-W clippy::nursery` add `#[allow(clippy::suboptimal_flops)]`

Check warning on line 148 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use Option::map_or_else instead of an if let/else

warning: use Option::map_or_else instead of an if let/else
   --> crates/jrsonnet-stdlib/src/strings.rs:142:15
    |
142 |           let digit = if let Some(digit) = checked_sub_if(BASE > 10, digit, LOWER_A_CODE) {
    |  _____________________^
143 | |             digit + 10
144 | |         } else if let Some(digit) = checked_sub_if(BASE > 10, digit, UPPER_A_CODE) {
145 | |             digit + 10
146 | |         } else {
147 | |             digit.checked_sub(ZERO_CODE).unwrap_or(BASE)
148 | |         };
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
help: try
    |
142 ~         let digit = checked_sub_if(BASE > 10, digit, LOWER_A_CODE).map_or_else(|| if let Some(digit) = checked_sub_if(BASE > 10, digit, UPPER_A_CODE) {
143 ~             digit + 10
144 ~         } else {
145 ~             digit.checked_sub(ZERO_CODE).unwrap_or(BASE)
146 ~         }, |digit| digit + 10);
    |

Check warning on line 138 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u32` to `f64` may become silently lossy if you later change the type

warning: casting `u32` to `f64` may become silently lossy if you later change the type
   --> crates/jrsonnet-stdlib/src/strings.rs:138:13
    |
138 |     let base = BASE as f64;
    |                ^^^^^^^^^^^ help: try: `f64::from(BASE)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
    = note: `-W clippy::cast-lossless` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::cast_lossless)]`

Check warning on line 136 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> crates/jrsonnet-stdlib/src/strings.rs:130:2
    |
130 | /     fn checked_sub_if(condition: bool, lhs: u32, rhs: u32) -> Option<u32> {
131 | |         if condition {
132 | |             lhs.checked_sub(rhs)
133 | |         } else {
134 | |             None
135 | |         }
136 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

Check warning on line 127 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> crates/jrsonnet-stdlib/src/strings.rs:127:2
    |
127 |     const LOWER_A_CODE: u32 = 'a' as u32;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

Check warning on line 126 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> crates/jrsonnet-stdlib/src/strings.rs:126:2
    |
126 |     const UPPER_A_CODE: u32 = 'A' as u32;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements

Check warning on line 125 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> crates/jrsonnet-stdlib/src/strings.rs:125:2
    |
125 |     const ZERO_CODE: u32 = '0' as u32;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
    = note: `-W clippy::items-after-statements` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::items_after_statements)]`

Check warning on line 78 in crates/jrsonnet-stdlib/src/strings.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
  --> crates/jrsonnet-stdlib/src/strings.rs:78:4
   |
78 |             out.push(Val::Num(ch_idx as f64))
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `out.push(Val::Num(ch_idx as f64));`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 194 in crates/jrsonnet-stdlib/src/manifest/toml.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary boolean `not` operation

warning: unnecessary boolean `not` operation
   --> crates/jrsonnet-stdlib/src/manifest/toml.rs:183:3
    |
183 | /         if !is_section(&value)? {
184 | |             if !first {
185 | |                 buf.push('\n');
186 | |             }
...   |
193 | |             sections.push((key, value));
194 | |         }
    | |_________^
    |
    = help: remove the `!` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else

Check warning on line 119 in crates/jrsonnet-stdlib/src/manifest/toml.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary `!=` operation

warning: unnecessary `!=` operation
   --> crates/jrsonnet-stdlib/src/manifest/toml.rs:115:5
    |
115 | /                 if i != 0 {
116 | |                     buf.push(',');
117 | |                 } else {
118 | |                     buf.push('[');
119 | |                 }
    | |_________________^
    |
    = help: change to `==` and swap the blocks of the `if`/`else`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
    = note: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::if_not_else)]`