Skip to content
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

Fix Clippy errors in latest Rust #888

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Fix Clippy errors in latest Rust #888

merged 1 commit into from
Dec 9, 2024

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Dec 9, 2024

Fixes Clippy errors like:

warning: unnecessary hashes around raw string literal
   --> libcnb-test/src/macros.rs:19:17
    |
19  | /                 r#"assertion failed: `(left contains right)`
20  | | left (unescaped):
21  | | {}
...   |
24  | | right: `{:?}`"#,
    | |_______________^
...
258 |           assert_contains!("Hello World!", "World");
    |           ----------------------------------------- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    = note: `-W clippy::needless-raw-string-hashes` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::needless_raw_string_hashes)]`
    = note: this warning originates in the macro `assert_contains` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove all the hashes around the string literal
    |
19  ~                 r"assertion failed: `(left contains right)`
20  | left (unescaped):
...
23  | left (escaped): `{:?}`
24  ~ right: `{:?}`",
warning: the following explicit lifetimes could be elided: 'a
  --> libcnb-test/src/test_context.rs:27:6
   |
27 | impl<'a> TestContext<'a> {
   |      ^^              ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
27 - impl<'a> TestContext<'a> {
27 + impl TestContext<'_> {
warning: this `map_or` is redundant
   --> libcnb-package/src/package_descriptor.rs:113:13
    |
113 | /             uri.scheme()
114 | |                 .map_or(false, |scheme| scheme.as_str() == "libcnb")
    | |____________________________________________________________________^ help: use is_some_and instead: `uri.scheme().is_some_and(|scheme| scheme.as_str() == "libcnb")`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `#[warn(clippy::unnecessary_map_or)]` on by default

GUS-W-17399229.

Fixes Clippy errors like:

```
warning: unnecessary hashes around raw string literal
   --> libcnb-test/src/macros.rs:19:17
    |
19  | /                 r#"assertion failed: `(left contains right)`
20  | | left (unescaped):
21  | | {}
...   |
24  | | right: `{:?}`"#,
    | |_______________^
...
258 |           assert_contains!("Hello World!", "World");
    |           ----------------------------------------- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    = note: `-W clippy::needless-raw-string-hashes` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::needless_raw_string_hashes)]`
    = note: this warning originates in the macro `assert_contains` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove all the hashes around the string literal
    |
19  ~                 r"assertion failed: `(left contains right)`
20  | left (unescaped):
...
23  | left (escaped): `{:?}`
24  ~ right: `{:?}`",
```

```
warning: the following explicit lifetimes could be elided: 'a
  --> libcnb-test/src/test_context.rs:27:6
   |
27 | impl<'a> TestContext<'a> {
   |      ^^              ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
27 - impl<'a> TestContext<'a> {
27 + impl TestContext<'_> {
```

```
warning: this `map_or` is redundant
   --> libcnb-package/src/package_descriptor.rs:113:13
    |
113 | /             uri.scheme()
114 | |                 .map_or(false, |scheme| scheme.as_str() == "libcnb")
    | |____________________________________________________________________^ help: use is_some_and instead: `uri.scheme().is_some_and(|scheme| scheme.as_str() == "libcnb")`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `#[warn(clippy::unnecessary_map_or)]` on by default
```
@edmorley edmorley merged commit 97b1887 into main Dec 9, 2024
8 checks passed
@edmorley edmorley deleted the edmorley/fix-clippy branch December 9, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants