-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Upgrade to Rust 1.86 and bump MSRV to 1.84 #17171
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| use std::fmt::Write as _; | ||
| use std::io::{self, BufWriter, Write}; | ||
|
|
||
| use anyhow::Result; | ||
|
|
@@ -43,12 +44,16 @@ impl<'a> Explanation<'a> { | |
|
|
||
| fn format_rule_text(rule: Rule) -> String { | ||
| let mut output = String::new(); | ||
| output.push_str(&format!("# {} ({})", rule.as_ref(), rule.noqa_code())); | ||
| let _ = write!(&mut output, "# {} ({})", rule.as_ref(), rule.noqa_code()); | ||
| output.push('\n'); | ||
| output.push('\n'); | ||
|
|
||
| let (linter, _) = Linter::parse_code(&rule.noqa_code().to_string()).unwrap(); | ||
| output.push_str(&format!("Derived from the **{}** linter.", linter.name())); | ||
| let _ = write!( | ||
| &mut output, | ||
| "Derived from the **{}** linter.", | ||
| linter.name() | ||
| ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda wonder if we should propose add something to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be great. I definitely don't love it and it has the downside that later refactoring the code to eg use a Write instead of a string now incorrectly suppresses errors (instead of Rust telling you that this might now fail) |
||
| output.push('\n'); | ||
| output.push('\n'); | ||
|
|
||
|
|
@@ -76,7 +81,7 @@ fn format_rule_text(rule: Rule) -> String { | |
| output.push_str("Message formats:"); | ||
| for format in rule.message_formats() { | ||
| output.push('\n'); | ||
| output.push_str(&format!("* {format}")); | ||
| let _ = write!(&mut output, "* {format}"); | ||
| } | ||
| } | ||
| output | ||
|
|
@@ -92,7 +97,7 @@ pub(crate) fn rule(rule: Rule, format: HelpFormat) -> Result<()> { | |
| HelpFormat::Json => { | ||
| serde_json::to_writer_pretty(stdout, &Explanation::from_rule(&rule))?; | ||
| } | ||
| }; | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.