-
Notifications
You must be signed in to change notification settings - Fork 2.6k
add a note that some warnings (and/or errors) can be auto-fixed #10989
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 | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -61,6 +61,7 @@ use crate::util::interning::InternedString; | |||||||||||||||||||||||||||
use crate::util::machine_message::{self, Message}; | ||||||||||||||||||||||||||||
use crate::util::{add_path_args, internal, iter_join_onto, profile}; | ||||||||||||||||||||||||||||
use cargo_util::{paths, ProcessBuilder, ProcessError}; | ||||||||||||||||||||||||||||
use rustfix::diagnostics::{Applicability, Diagnostic}; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
const RUSTDOC_CRATE_VERSION_FLAG: &str = "--crate-version"; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
@@ -1420,7 +1421,10 @@ fn on_stderr_line_inner( | |||||||||||||||||||||||||||
rendered: String, | ||||||||||||||||||||||||||||
message: String, | ||||||||||||||||||||||||||||
level: String, | ||||||||||||||||||||||||||||
// `children: Vec<Diagnostic>` if we need to check them recursively | ||||||||||||||||||||||||||||
children: Vec<Diagnostic>, | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Comment on lines
+1425
to
+1427
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. Should we hand-pick field to deserialize? I see other places doing so.
Suggested change
BTW, I feel like every existing ad-hoc deserialization should have a comment telling which struct it refers to. 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'm not sure what you mean by this 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 mean deserializing only those fields we need instead of the whole Diagnostic struct 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. We could do that but I was trying to use the available types from 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. If there is an update of types in I was asking because other places deserialize fields-of-interest. Besides, there might be a performance hit if a package start emitting thousands of warnings with full struct fields, though I guess it is rare. Anyway, I am good with reuse types from |
||||||||||||||||||||||||||||
if let Ok(mut msg) = serde_json::from_str::<CompilerMessage>(compiler_message.get()) { | ||||||||||||||||||||||||||||
if msg.message.starts_with("aborting due to") | ||||||||||||||||||||||||||||
|| msg.message.ends_with("warning emitted") | ||||||||||||||||||||||||||||
|
@@ -1443,8 +1447,19 @@ fn on_stderr_line_inner( | |||||||||||||||||||||||||||
.expect("strip should never fail") | ||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||
if options.show_diagnostics { | ||||||||||||||||||||||||||||
let machine_applicable: bool = msg | ||||||||||||||||||||||||||||
.children | ||||||||||||||||||||||||||||
.iter() | ||||||||||||||||||||||||||||
.map(|child| { | ||||||||||||||||||||||||||||
child | ||||||||||||||||||||||||||||
weihanglo marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||
.spans | ||||||||||||||||||||||||||||
.iter() | ||||||||||||||||||||||||||||
.filter_map(|span| span.suggestion_applicability) | ||||||||||||||||||||||||||||
.any(|app| app == Applicability::MachineApplicable) | ||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||
.any(|b| b); | ||||||||||||||||||||||||||||
count_diagnostic(&msg.level, options); | ||||||||||||||||||||||||||||
state.emit_diag(msg.level, rendered)?; | ||||||||||||||||||||||||||||
state.emit_diag(msg.level, rendered, machine_applicable)?; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
return Ok(true); | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.