diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-06-23 18:29:30 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-06-23 19:34:28 -0700 |
| commit | 426331b9e44a955b0e43da9b1542b7cf15fac31e (patch) | |
| tree | ec2a7b7e83f328f598efab11dab31718fe7fc1d8 /src | |
| parent | 229d0d3266002d343cdd2f4a3bf7f2fe9da15f38 (diff) | |
| download | rust-426331b9e44a955b0e43da9b1542b7cf15fac31e.tar.gz rust-426331b9e44a955b0e43da9b1542b7cf15fac31e.zip | |
remove unused parameters from LintStore.find_lint
Long ago, in the before-time, the find_lint method was created with the
unused_variables ("unused_variable" in the singular, as it was called at
the time) attribute in anticipation of using the session and span in the
handling of renamed lints (31b7d64fd), and indeed, the session and span
came to be used in this method, while the unused_variables attribute
remained (1ad1e2e29). In modern times, the session and span are again no
longer used (ca81d3dd); it seems we can safely prune them from the
method signature, for justice, and mercy.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/lint/context.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index a9e0ef51102..a550db34d6f 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -291,16 +291,13 @@ impl LintStore { self.by_name.insert(name.into(), Removed(reason.into())); } - #[allow(unused_variables)] - fn find_lint(&self, lint_name: &str, sess: &Session, span: Option<Span>) - -> Result<LintId, FindLintError> - { + fn find_lint(&self, lint_name: &str) -> Result<LintId, FindLintError> { match self.by_name.get(lint_name) { Some(&Id(lint_id)) => Ok(lint_id), Some(&Renamed(_, lint_id)) => { Ok(lint_id) }, - Some(&Removed(ref reason)) => { + Some(&Removed(_)) => { Err(FindLintError::Removed) }, None => Err(FindLintError::NotFound) @@ -313,7 +310,7 @@ impl LintStore { &lint_name[..], level); let lint_flag_val = Symbol::intern(&lint_name); - match self.find_lint(&lint_name[..], sess, None) { + match self.find_lint(&lint_name[..]) { Ok(lint_id) => self.levels.set(lint_id, (level, CommandLine(lint_flag_val))), Err(FindLintError::Removed) => { } Err(_) => { @@ -731,7 +728,7 @@ pub trait LintContext<'tcx>: Sized { continue; } Ok((lint_name, level, span)) => { - match self.lints().find_lint(&lint_name.as_str(), &self.sess(), Some(span)) { + match self.lints().find_lint(&lint_name.as_str()) { Ok(lint_id) => vec![(lint_id, level, span)], Err(FindLintError::NotFound) => { match self.lints().lint_groups.get(&*lint_name.as_str()) { @@ -1420,7 +1417,7 @@ impl Decodable for LintId { fn decode<D: Decoder>(d: &mut D) -> Result<LintId, D::Error> { let s = d.read_str()?; ty::tls::with(|tcx| { - match tcx.sess.lint_store.borrow().find_lint(&s, tcx.sess, None) { + match tcx.sess.lint_store.borrow().find_lint(&s) { Ok(id) => Ok(id), Err(_) => panic!("invalid lint-id `{}`", s), } |
