Skip to content

Commit 5af5a6d

Browse files
committed
Add missing docs and remove dead code
1 parent 33cc7b1 commit 5af5a6d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

compiler/rustc_errors/src/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,18 @@ impl Handler {
521521
}
522522

523523
/// Construct a builder at the `Warning` level at the given `span` and with the `msg`.
524-
/// Cancel the builder if warnings cannot be emitted
524+
///
525+
/// The builder will be canceled if warnings cannot be emitted.
525526
pub fn struct_span_warn(&self, span: impl Into<MultiSpan>, msg: &str) -> DiagnosticBuilder<'_> {
526527
let mut result = self.struct_warn(msg);
527528
result.set_span(span);
528529
result
529530
}
530531

531532
/// Construct a builder at the `Warning` level at the given `span` and with the `msg`.
533+
///
534+
/// This will "force" the warning meaning it will not be canceled even
535+
/// if warnings cannot be emitted.
532536
pub fn struct_span_force_warn(
533537
&self,
534538
span: impl Into<MultiSpan>,
@@ -564,7 +568,8 @@ impl Handler {
564568
}
565569

566570
/// Construct a builder at the `Warning` level with the `msg`.
567-
/// Cancel the builder if warnings cannot be emitted
571+
///
572+
/// The builder will be canceled if warnings cannot be emitted.
568573
pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
569574
let mut result = DiagnosticBuilder::new(self, Level::Warning, msg);
570575
if !self.flags.can_emit_warnings {
@@ -574,6 +579,9 @@ impl Handler {
574579
}
575580

576581
/// Construct a builder at the `Warning` level with the `msg`.
582+
///
583+
/// This will "force" a warning meaning it will not be canceled even
584+
/// if warnings cannot be emitted.
577585
pub fn struct_force_warn(&self, msg: &str) -> DiagnosticBuilder<'_> {
578586
DiagnosticBuilder::new(self, Level::Warning, msg)
579587
}

compiler/rustc_middle/src/lint.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,6 @@ pub fn struct_lint_level<'s, 'd>(
251251
let has_future_breakage =
252252
future_incompatible.map_or(false, |incompat| incompat.future_breakage.is_some());
253253

254-
let is_force_warn = matches!(level, Level::ForceWarn)
255-
|| matches!(src, LintLevelSource::CommandLine(_, Level::ForceWarn));
256-
257254
let mut err = match (level, span) {
258255
(Level::Allow, span) => {
259256
if has_future_breakage {
@@ -359,6 +356,7 @@ pub fn struct_lint_level<'s, 'd>(
359356
}
360357
}
361358

359+
let is_force_warn = matches!(level, Level::ForceWarn);
362360
err.code(DiagnosticId::Lint { name, has_future_breakage, is_force_warn });
363361

364362
if let Some(future_incompatible) = future_incompatible {

0 commit comments

Comments
 (0)