1
Fork 0

replace redundant note in deprecation warning

This commit is contained in:
Andy Russell 2019-03-23 21:13:57 -04:00
parent 0633c55d20
commit 8d7c2bb06a
No known key found for this signature in database
GPG key ID: BE2221033EDBC374
5 changed files with 72 additions and 6 deletions

View file

@ -576,7 +576,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
if let hir::Node::Expr(_) = self.hir().get_by_hir_id(id) {
diag.span_suggestion(
span,
&msg,
"replace the use of the deprecated item",
suggestion.to_string(),
Applicability::MachineApplicable,
);

View file

@ -2,11 +2,7 @@ warning: use of deprecated item 'std::sync::atomic::ATOMIC_ISIZE_INIT': the `new
--> $DIR/atomic_initializers.rs:8:27
|
LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated item: `AtomicIsize::new(0)`
|
= note: #[warn(deprecated)] on by default
help: use of deprecated item 'std::sync::atomic::ATOMIC_ISIZE_INIT': the `new` function is now preferred
|
LL | static FOO: AtomicIsize = AtomicIsize::new(0);
| ^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,28 @@
// run-rustfix
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]
#![deny(deprecated)]
#![allow(dead_code)]
struct Foo;
impl Foo {
#[rustc_deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
fn deprecated(&self) {}
fn replacement(&self) {}
}
fn main() {
let foo = Foo;
foo.replacement(); //~ ERROR use of deprecated
}

View file

@ -0,0 +1,28 @@
// run-rustfix
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]
#![deny(deprecated)]
#![allow(dead_code)]
struct Foo;
impl Foo {
#[rustc_deprecated(
since = "1.0.0",
reason = "replaced by `replacement`",
suggestion = "replacement",
)]
#[stable(since = "1.0.0", feature = "test")]
fn deprecated(&self) {}
fn replacement(&self) {}
}
fn main() {
let foo = Foo;
foo.deprecated(); //~ ERROR use of deprecated
}

View file

@ -0,0 +1,14 @@
error: use of deprecated item 'Foo::deprecated': replaced by `replacement`
--> $DIR/suggestion.rs:27:9
|
LL | foo.deprecated();
| ^^^^^^^^^^ help: replace the use of the deprecated item: `replacement`
|
note: lint level defined here
--> $DIR/suggestion.rs:7:9
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
error: aborting due to previous error