Skip to content

Commit 426331b

Browse files
committed
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 (31b7d64), and indeed, the session and span came to be used in this method, while the unused_variables attribute remained (1ad1e2e). In modern times, the session and span are again no longer used (ca81d3d); it seems we can safely prune them from the method signature, for justice, and mercy.
1 parent 229d0d3 commit 426331b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/librustc/lint/context.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,13 @@ impl LintStore {
291291
self.by_name.insert(name.into(), Removed(reason.into()));
292292
}
293293

294-
#[allow(unused_variables)]
295-
fn find_lint(&self, lint_name: &str, sess: &Session, span: Option<Span>)
296-
-> Result<LintId, FindLintError>
297-
{
294+
fn find_lint(&self, lint_name: &str) -> Result<LintId, FindLintError> {
298295
match self.by_name.get(lint_name) {
299296
Some(&Id(lint_id)) => Ok(lint_id),
300297
Some(&Renamed(_, lint_id)) => {
301298
Ok(lint_id)
302299
},
303-
Some(&Removed(ref reason)) => {
300+
Some(&Removed(_)) => {
304301
Err(FindLintError::Removed)
305302
},
306303
None => Err(FindLintError::NotFound)
@@ -313,7 +310,7 @@ impl LintStore {
313310
&lint_name[..], level);
314311

315312
let lint_flag_val = Symbol::intern(&lint_name);
316-
match self.find_lint(&lint_name[..], sess, None) {
313+
match self.find_lint(&lint_name[..]) {
317314
Ok(lint_id) => self.levels.set(lint_id, (level, CommandLine(lint_flag_val))),
318315
Err(FindLintError::Removed) => { }
319316
Err(_) => {
@@ -731,7 +728,7 @@ pub trait LintContext<'tcx>: Sized {
731728
continue;
732729
}
733730
Ok((lint_name, level, span)) => {
734-
match self.lints().find_lint(&lint_name.as_str(), &self.sess(), Some(span)) {
731+
match self.lints().find_lint(&lint_name.as_str()) {
735732
Ok(lint_id) => vec![(lint_id, level, span)],
736733
Err(FindLintError::NotFound) => {
737734
match self.lints().lint_groups.get(&*lint_name.as_str()) {
@@ -1420,7 +1417,7 @@ impl Decodable for LintId {
14201417
fn decode<D: Decoder>(d: &mut D) -> Result<LintId, D::Error> {
14211418
let s = d.read_str()?;
14221419
ty::tls::with(|tcx| {
1423-
match tcx.sess.lint_store.borrow().find_lint(&s, tcx.sess, None) {
1420+
match tcx.sess.lint_store.borrow().find_lint(&s) {
14241421
Ok(id) => Ok(id),
14251422
Err(_) => panic!("invalid lint-id `{}`", s),
14261423
}

0 commit comments

Comments
 (0)