Clippy fixes, rename stuff to match RFC

This commit is contained in:
Aaron Hill 2019-01-13 22:29:52 -05:00
parent 12f9b796ff
commit d60214cdf7
No known key found for this signature in database
GPG key ID: B4087E510E98B164
9 changed files with 32 additions and 13 deletions

View file

@ -126,7 +126,7 @@ declare_lint! {
} }
declare_lint! { declare_lint! {
pub LEAKED_PRIVATE_DEPENDENCY, pub EXTERNAL_PRIVATE_DEPENDENCY,
Warn, Warn,
"public interface leaks type from a private dependency" "public interface leaks type from a private dependency"
} }
@ -411,7 +411,7 @@ impl LintPass for HardwiredLints {
TRIVIAL_CASTS, TRIVIAL_CASTS,
TRIVIAL_NUMERIC_CASTS, TRIVIAL_NUMERIC_CASTS,
PRIVATE_IN_PUBLIC, PRIVATE_IN_PUBLIC,
LEAKED_PRIVATE_DEPENDENCY, EXTERNAL_PRIVATE_DEPENDENCY,
PUB_USE_OF_PRIVATE_EXTERN_CRATE, PUB_USE_OF_PRIVATE_EXTERN_CRATE,
INVALID_TYPE_PARAM_DEFAULT, INVALID_TYPE_PARAM_DEFAULT,
CONST_ERR, CONST_ERR,

View file

@ -1928,7 +1928,7 @@ pub fn build_session_options_and_crate_config(
let mut extern_public: FxHashSet<String> = matches.opt_strs("extern-public"). let mut extern_public: FxHashSet<String> = matches.opt_strs("extern-public").
iter().cloned().collect(); iter().cloned().collect();
// TODO - come up with a better way of handling this // FIXME - come up with a better way of handling this
extern_public.insert("core".to_string()); extern_public.insert("core".to_string());
extern_public.insert("std".to_string()); extern_public.insert("std".to_string());

View file

@ -1883,5 +1883,3 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
} }
} }

View file

@ -230,7 +230,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
edition: None, edition: None,
}, },
FutureIncompatibleInfo { FutureIncompatibleInfo {
id: LintId::of(LEAKED_PRIVATE_DEPENDENCY), id: LintId::of(EXTERNAL_PRIVATE_DEPENDENCY),
reference: "issue #44663 <https://github.com/rust-lang/rust/issues/44663>", reference: "issue #44663 <https://github.com/rust-lang/rust/issues/44663>",
edition: None, edition: None,
}, },

View file

@ -1496,7 +1496,7 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> {
fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool {
if self.leaks_private_dep(def_id) { if self.leaks_private_dep(def_id) {
self.tcx.lint_node(lint::builtin::LEAKED_PRIVATE_DEPENDENCY, self.tcx.lint_node(lint::builtin::EXTERNAL_PRIVATE_DEPENDENCY,
self.item_id, self.item_id,
self.span, self.span,
&format!("{} `{}` from private dependency '{}' in public \ &format!("{} `{}` from private dependency '{}' in public \

View file

@ -0,0 +1 @@
pub struct PubType;

View file

@ -0,0 +1,20 @@
// This test is different from other feature gate tests.
// Instead of checking that an error occurs without the feature gate,
// it checks that *no* errors/warnings occurs without the feature gate.
// This is due to the fact that 'public_private_dependencies' just enables
// a lint, so disabling it shouldn't cause any code to stop compiling.
// run-pass
// aux-build:pub_dep.rs
// Without ![feature(public_private_dependencies)],
// this should do nothing/
#![deny(external_private_dependency)]
extern crate pub_dep;
pub struct Foo {
pub field: pub_dep::PubType
}
fn main() {}

View file

@ -2,7 +2,7 @@
// aux-build:pub_dep.rs // aux-build:pub_dep.rs
// compile-flags: --extern-public=pub_dep // compile-flags: --extern-public=pub_dep
#![feature(public_private_dependencies)] #![feature(public_private_dependencies)]
#![deny(leaked_private_dependency)] #![deny(external_private_dependency)]
// This crate is a private dependency // This crate is a private dependency
extern crate priv_dep; extern crate priv_dep;
@ -20,7 +20,7 @@ struct PrivateType {
pub struct PublicType { pub struct PublicType {
pub field: OtherType, pub field: OtherType,
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
//~| WARNING this was previously accepted //~| WARNING this was previously accepted
priv_field: OtherType, // Private field - this is fine priv_field: OtherType, // Private field - this is fine
pub other_field: PubType // Type from public dependency - this is fine pub other_field: PubType // Type from public dependency - this is fine
@ -28,7 +28,7 @@ pub struct PublicType {
impl PublicType { impl PublicType {
pub fn pub_fn(param: OtherType) {} pub fn pub_fn(param: OtherType) {}
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] //~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface
//~| WARNING this was previously accepted //~| WARNING this was previously accepted
fn priv_fn(param: OtherType) {} fn priv_fn(param: OtherType) {}
@ -37,7 +37,7 @@ impl PublicType {
pub trait MyPubTrait { pub trait MyPubTrait {
type Foo: OtherTrait; type Foo: OtherTrait;
} }
//~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface [leaked_private_dependency] //~^^^ ERROR trait `priv_dep::OtherTrait` from private dependency 'priv_dep' in public interface
//~| WARNING this was previously accepted //~| WARNING this was previously accepted

View file

@ -7,8 +7,8 @@ LL | pub field: OtherType,
note: lint level defined here note: lint level defined here
--> $DIR/pub-priv1.rs:5:9 --> $DIR/pub-priv1.rs:5:9
| |
LL | #![deny(leaked_private_dependency)] LL | #![deny(external_private_dependency)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663> = note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663>