-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
docs(website): fix incorrect example about the contains
function
#22499
base: master
Are you sure you want to change the base?
Conversation
The `contains` function is now infallible and always returns a boolean value. This commit fixes the example in the `transformation` guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seunghunee, will merge once the CLA is signed.
@@ -138,8 +138,8 @@ transforms: | |||
# If the log message contains the phrase "Great Scott!", set the new field | |||
# "critical" to true, otherwise set it to false. If the "contains" function | |||
# errors, log the error (instead of aborting the script, as above). | |||
if (is_critical, err = contains(.message, "Great Scott!"); err != null) { | |||
log(err, level: "error") | |||
if (is_critical = contains(.message, "Great Scott!"); is_critical) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, took another look. This is still a fallible assignment per: playground
What we want instead is:
is_critical = contains(string!(.message), "Great Scott!")
Summary
The
contains
function is now infallible and always returns a boolean value.This commit fixes the incorrect example in the
transformation
guide.Change Type
Is this a breaking change?
How did you test this PR?
Does this PR include user facing changes?
Checklist
make check-all
is a good command to run locally. This check isdefined here. Some of these
checks might not be relevant to your PR. For Rust changes, at the very least you should run:
cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
cargo nextest run --workspace
(alternatively, you can runcargo test --all
)Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References