Fix nightly clippy warnings

This commit is contained in:
Jeong Yunwon
2022-06-24 01:13:32 +09:00
parent 166c45d575
commit 8c0be4b48f
11 changed files with 19 additions and 18 deletions

View File

@@ -71,7 +71,7 @@ impl std::fmt::Display for Constant {
}
/// Transforms a value prior to formatting it.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ConversionFlag {
/// Converts by calling `str(<value>)`.

View File

@@ -3,7 +3,7 @@
use std::fmt;
/// A location somewhere in the sourcecode.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Location {
row: usize,
column: usize,

View File

@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use std::{collections::BTreeSet, fmt, hash};
/// Sourcecode location.
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct Location {
row: u32,
column: u32,
@@ -158,7 +158,7 @@ impl fmt::Display for Label {
}
/// Transforms a value prior to formatting it.
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum ConversionFlag {
/// No conversion
None,
@@ -171,7 +171,7 @@ pub enum ConversionFlag {
}
/// The kind of Raise that occurred.
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RaiseKind {
Reraise,
Raise,
@@ -181,7 +181,7 @@ pub enum RaiseKind {
pub type NameIdx = u32;
/// A Single bytecode instruction.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum Instruction {
/// Importing by name
ImportName {
@@ -582,7 +582,7 @@ pub enum TestOperator {
/// use rustpython_bytecode::BinaryOperator::Add;
/// let op = BinaryOperation {op: Add};
/// ```
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BinaryOperator {
Power,
Multiply,
@@ -600,7 +600,7 @@ pub enum BinaryOperator {
}
/// The possible unary operators
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum UnaryOperator {
Not,
Invert,

View File

@@ -73,7 +73,7 @@ where
}
// we need to coerce the lifetime to that of the function body rather than the
// anonymous input lifetime, so that we can assign it data borrowed from data_from_err
let mut data = &*data;
let mut data = data;
let mut data_from_err: E::BytesBuf;
let mut out = String::with_capacity(data.len());
let mut remaining_index = 0;

View File

@@ -62,7 +62,7 @@ impl SymbolTable {
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SymbolTableType {
Module,
Class,
@@ -83,7 +83,7 @@ impl fmt::Display for SymbolTableType {
/// Indicator for a single symbol what the scope of this symbol is.
/// The scope can be unknown, which is unfortunate, but not impossible.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SymbolScope {
Unknown,
Local,

View File

@@ -163,7 +163,7 @@ impl JitSig {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum JitType {
Int,

View File

@@ -91,7 +91,7 @@ impl PyMappingProxy {
MappingProxyInner::Class(class) => Ok(key
.as_interned_str(vm)
.map_or(false, |key| class.attributes.read().contains_key(key))),
MappingProxyInner::Mapping(mapping) => PySequence::contains(&*mapping, key, vm),
MappingProxyInner::Mapping(mapping) => PySequence::contains(mapping, key, vm),
}
}

View File

@@ -1611,7 +1611,7 @@ mod tests {
impl<'s> AnyStrWrapper<'s> for PyStrRef {
type Str = str;
fn as_ref(&self) -> &str {
&*self.as_str()
self.as_str()
}
}

View File

@@ -95,7 +95,7 @@ impl TryFromObject for ArgIntoFloat {
/// By default an object is considered true unless its class defines either a
/// `__bool__()` method that returns False or a `__len__()` method that returns
/// zero, when called with the object.
#[derive(Debug, Default, PartialEq)]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct ArgIntoBool {
value: bool,
}

View File

@@ -47,7 +47,8 @@ mod basic_readline {
return ReadlineResult::Io(e);
}
match io::stdin().lock().lines().next() {
let next_line = io::stdin().lock().lines().next();
match next_line {
Some(Ok(line)) => ReadlineResult::Line(line),
None => ReadlineResult::Eof,
Some(Err(e)) => match e.kind() {

View File

@@ -767,10 +767,10 @@ mod decl {
}
}
// We don't have an int or value was < 0 or > sys.maxsize
return Err(vm.new_value_error(format!(
Err(vm.new_value_error(format!(
"{} argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.",
name
)));
)))
}
#[pyimpl(with(IterNext))]