@@ -632,27 +632,15 @@ impl Handler {
632
632
633
633
/// Construct a builder at the `Warning` level at the given `span` and with the `msg`.
634
634
///
635
- /// The builder will be canceled if warnings cannot be emitted.
635
+ /// Attempting to `.emit()` the builder will only emit if either:
636
+ /// * `can_emit_warnings` is `true`
637
+ /// * `is_force_warn` was set in `DiagnosticId::Lint`
636
638
pub fn struct_span_warn ( & self , span : impl Into < MultiSpan > , msg : & str ) -> DiagnosticBuilder < ' _ > {
637
639
let mut result = self . struct_warn ( msg) ;
638
640
result. set_span ( span) ;
639
641
result
640
642
}
641
643
642
- /// Construct a builder at the `Warning` level at the given `span` and with the `msg`.
643
- ///
644
- /// This will "force" the warning meaning it will not be canceled even
645
- /// if warnings cannot be emitted.
646
- pub fn struct_span_force_warn (
647
- & self ,
648
- span : impl Into < MultiSpan > ,
649
- msg : & str ,
650
- ) -> DiagnosticBuilder < ' _ > {
651
- let mut result = self . struct_force_warn ( msg) ;
652
- result. set_span ( span) ;
653
- result
654
- }
655
-
656
644
/// Construct a builder at the `Allow` level at the given `span` and with the `msg`.
657
645
pub fn struct_span_allow (
658
646
& self ,
@@ -679,20 +667,10 @@ impl Handler {
679
667
680
668
/// Construct a builder at the `Warning` level with the `msg`.
681
669
///
682
- /// The builder will be canceled if warnings cannot be emitted.
670
+ /// Attempting to `.emit()` the builder will only emit if either:
671
+ /// * `can_emit_warnings` is `true`
672
+ /// * `is_force_warn` was set in `DiagnosticId::Lint`
683
673
pub fn struct_warn ( & self , msg : & str ) -> DiagnosticBuilder < ' _ > {
684
- let mut result = DiagnosticBuilder :: new ( self , Level :: Warning , msg) ;
685
- if !self . flags . can_emit_warnings {
686
- result. cancel ( ) ;
687
- }
688
- result
689
- }
690
-
691
- /// Construct a builder at the `Warning` level with the `msg`.
692
- ///
693
- /// This will "force" a warning meaning it will not be canceled even
694
- /// if warnings cannot be emitted.
695
- pub fn struct_force_warn ( & self , msg : & str ) -> DiagnosticBuilder < ' _ > {
696
674
DiagnosticBuilder :: new ( self , Level :: Warning , msg)
697
675
}
698
676
0 commit comments