Skip to content

Commit a75e7ed

Browse files
Merge pull request #1486 from JarlEvanson/fix-clippy-use-self
Fix clippy::use_self
2 parents c001431 + 7874a93 commit a75e7ed

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

uefi/src/proto/debug/exception.rs

+51-51
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,39 @@ impl ExceptionType {
3131
#[cfg(target_arch = "x86")]
3232
impl ExceptionType {
3333
/// Divide-by-zero Error
34-
pub const EXCEPT_IA32_DIVIDE_ERROR: ExceptionType = ExceptionType(0);
34+
pub const EXCEPT_IA32_DIVIDE_ERROR: Self = Self(0);
3535
/// Debug Exception
36-
pub const EXCEPT_IA32_DEBUG: ExceptionType = ExceptionType(1);
36+
pub const EXCEPT_IA32_DEBUG: Self = Self(1);
3737
/// Non-maskable Interrupt
38-
pub const EXCEPT_IA32_NMI: ExceptionType = ExceptionType(2);
38+
pub const EXCEPT_IA32_NMI: Self = Self(2);
3939
/// Breakpoint
40-
pub const EXCEPT_IA32_BREAKPOINT: ExceptionType = ExceptionType(3);
40+
pub const EXCEPT_IA32_BREAKPOINT: Self = Self(3);
4141
/// Overflow
42-
pub const EXCEPT_IA32_OVERFLOW: ExceptionType = ExceptionType(4);
42+
pub const EXCEPT_IA32_OVERFLOW: Self = Self(4);
4343
/// Bound Range Exceeded
44-
pub const EXCEPT_IA32_BOUND: ExceptionType = ExceptionType(5);
44+
pub const EXCEPT_IA32_BOUND: Self = Self(5);
4545
/// Invalid Opcode
46-
pub const EXCEPT_IA32_INVALID_OPCODE: ExceptionType = ExceptionType(6);
46+
pub const EXCEPT_IA32_INVALID_OPCODE: Self = Self(6);
4747
/// Double Fault
48-
pub const EXCEPT_IA32_DOUBLE_FAULT: ExceptionType = ExceptionType(8);
48+
pub const EXCEPT_IA32_DOUBLE_FAULT: Self = Self(8);
4949
/// Invalid TSS
50-
pub const EXCEPT_IA32_INVALID_TSS: ExceptionType = ExceptionType(10);
50+
pub const EXCEPT_IA32_INVALID_TSS: Self = Self(10);
5151
/// Segment Not Present
52-
pub const EXCEPT_IA32_SEG_NOT_PRESENT: ExceptionType = ExceptionType(11);
52+
pub const EXCEPT_IA32_SEG_NOT_PRESENT: Self = Self(11);
5353
/// Stack-Segment Fault
54-
pub const EXCEPT_IA32_STACK_FAULT: ExceptionType = ExceptionType(12);
54+
pub const EXCEPT_IA32_STACK_FAULT: Self = Self(12);
5555
/// General Protection Fault
56-
pub const EXCEPT_IA32_GP_FAULT: ExceptionType = ExceptionType(13);
56+
pub const EXCEPT_IA32_GP_FAULT: Self = Self(13);
5757
/// Page Fault
58-
pub const EXCEPT_IA32_PAGE_FAULT: ExceptionType = ExceptionType(14);
58+
pub const EXCEPT_IA32_PAGE_FAULT: Self = Self(14);
5959
/// x87 Floating-Point Exception
60-
pub const EXCEPT_IA32_FP_ERROR: ExceptionType = ExceptionType(16);
60+
pub const EXCEPT_IA32_FP_ERROR: Self = Self(16);
6161
/// Alignment Check
62-
pub const EXCEPT_IA32_ALIGNMENT_CHECK: ExceptionType = ExceptionType(17);
62+
pub const EXCEPT_IA32_ALIGNMENT_CHECK: Self = Self(17);
6363
/// Machine Check
64-
pub const EXCEPT_IA32_MACHINE_CHECK: ExceptionType = ExceptionType(18);
64+
pub const EXCEPT_IA32_MACHINE_CHECK: Self = Self(18);
6565
/// SIMD Floating-Point Exception
66-
pub const EXCEPT_IA32_SIMD: ExceptionType = ExceptionType(19);
66+
pub const EXCEPT_IA32_SIMD: Self = Self(19);
6767
}
6868

6969
#[cfg(target_arch = "x86_64")]
@@ -107,80 +107,80 @@ impl ExceptionType {
107107
#[cfg(target_arch = "arm")]
108108
impl ExceptionType {
109109
/// Processor reset
110-
pub const EXCEPT_ARM_RESET: ExceptionType = ExceptionType(0);
110+
pub const EXCEPT_ARM_RESET: Self = Self(0);
111111
/// Undefined instruction
112-
pub const EXCEPT_ARM_UNDEFINED_INSTRUCTION: ExceptionType = ExceptionType(1);
112+
pub const EXCEPT_ARM_UNDEFINED_INSTRUCTION: Self = Self(1);
113113
/// Software Interrupt
114-
pub const EXCEPT_ARM_SOFTWARE_INTERRUPT: ExceptionType = ExceptionType(2);
114+
pub const EXCEPT_ARM_SOFTWARE_INTERRUPT: Self = Self(2);
115115
/// Prefetch aborted
116-
pub const EXCEPT_ARM_PREFETCH_ABORT: ExceptionType = ExceptionType(3);
116+
pub const EXCEPT_ARM_PREFETCH_ABORT: Self = Self(3);
117117
/// Data access memory abort
118-
pub const EXCEPT_ARM_DATA_ABORT: ExceptionType = ExceptionType(4);
118+
pub const EXCEPT_ARM_DATA_ABORT: Self = Self(4);
119119
/// Reserved
120-
pub const EXCEPT_ARM_RESERVED: ExceptionType = ExceptionType(5);
120+
pub const EXCEPT_ARM_RESERVED: Self = Self(5);
121121
/// Normal interrupt
122-
pub const EXCEPT_ARM_IRQ: ExceptionType = ExceptionType(6);
122+
pub const EXCEPT_ARM_IRQ: Self = Self(6);
123123
/// Fast interrupt
124-
pub const EXCEPT_ARM_FIQ: ExceptionType = ExceptionType(7);
124+
pub const EXCEPT_ARM_FIQ: Self = Self(7);
125125
/// In the UEFI spec for "convenience", unsure if we'll need it. Set to `EXCEPT_ARM_FIQ`
126-
pub const MAX_ARM_EXCEPTION: ExceptionType = ExceptionType::EXCEPT_ARM_FIQ;
126+
pub const MAX_ARM_EXCEPTION: Self = Self::EXCEPT_ARM_FIQ;
127127
}
128128

129129
#[cfg(target_arch = "aarch64")]
130130
impl ExceptionType {
131131
/// Synchronous exception, such as attempting to execute an invalid instruction
132-
pub const EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: ExceptionType = ExceptionType(0);
132+
pub const EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS: Self = Self(0);
133133
/// Normal interrupt
134-
pub const EXCEPT_AARCH64_IRQ: ExceptionType = ExceptionType(1);
134+
pub const EXCEPT_AARCH64_IRQ: Self = Self(1);
135135
/// Fast interrupt
136-
pub const EXCEPT_AARCH64_FIQ: ExceptionType = ExceptionType(2);
136+
pub const EXCEPT_AARCH64_FIQ: Self = Self(2);
137137
/// System Error
138-
pub const EXCEPT_AARCH64_SERROR: ExceptionType = ExceptionType(3);
138+
pub const EXCEPT_AARCH64_SERROR: Self = Self(3);
139139
/// In the UEFI spec for "convenience", unsure if we'll need it. Set to `EXCEPT_AARCH64_SERROR`
140-
pub const MAX_AARCH64_EXCEPTION: ExceptionType = ExceptionType::EXCEPT_AARCH64_SERROR;
140+
pub const MAX_AARCH64_EXCEPTION: Self = Self::EXCEPT_AARCH64_SERROR;
141141
}
142142

143143
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
144144
impl ExceptionType {
145145
/// Instruction misaligned
146-
pub const EXCEPT_RISCV_INST_MISALIGNED: ExceptionType = ExceptionType(0);
146+
pub const EXCEPT_RISCV_INST_MISALIGNED: Self = Self(0);
147147
/// Instruction access fault
148-
pub const EXCEPT_RISCV_INST_ACCESS_FAULT: ExceptionType = ExceptionType(1);
148+
pub const EXCEPT_RISCV_INST_ACCESS_FAULT: Self = Self(1);
149149
/// Illegal instruction
150-
pub const EXCEPT_RISCV_ILLEGAL_INST: ExceptionType = ExceptionType(2);
150+
pub const EXCEPT_RISCV_ILLEGAL_INST: Self = Self(2);
151151
/// Breakpoint
152-
pub const EXCEPT_RISCV_BREAKPOINT: ExceptionType = ExceptionType(3);
152+
pub const EXCEPT_RISCV_BREAKPOINT: Self = Self(3);
153153
/// Load address misaligned
154-
pub const EXCEPT_RISCV_LOAD_ADDRESS_MISALIGNED: ExceptionType = ExceptionType(4);
154+
pub const EXCEPT_RISCV_LOAD_ADDRESS_MISALIGNED: Self = Self(4);
155155
/// Load accept fault
156-
pub const EXCEPT_RISCV_LOAD_ACCESS_FAULT: ExceptionType = ExceptionType(5);
156+
pub const EXCEPT_RISCV_LOAD_ACCESS_FAULT: Self = Self(5);
157157
/// Store AMO address misaligned
158-
pub const EXCEPT_RISCV_STORE_AMO_ADDRESS_MISALIGNED: ExceptionType = ExceptionType(6);
158+
pub const EXCEPT_RISCV_STORE_AMO_ADDRESS_MISALIGNED: Self = Self(6);
159159
/// Store AMO access fault
160-
pub const EXCEPT_RISCV_STORE_AMO_ACCESS_FAULT: ExceptionType = ExceptionType(7);
160+
pub const EXCEPT_RISCV_STORE_AMO_ACCESS_FAULT: Self = Self(7);
161161
/// ECALL from User mode
162-
pub const EXCEPT_RISCV_ENV_CALL_FROM_UMODE: ExceptionType = ExceptionType(8);
162+
pub const EXCEPT_RISCV_ENV_CALL_FROM_UMODE: Self = Self(8);
163163
/// ECALL from Supervisor mode
164-
pub const EXCEPT_RISCV_ENV_CALL_FROM_SMODE: ExceptionType = ExceptionType(9);
164+
pub const EXCEPT_RISCV_ENV_CALL_FROM_SMODE: Self = Self(9);
165165
/// ECALL from Machine mode
166-
pub const EXCEPT_RISCV_ENV_CALL_FROM_MMODE: ExceptionType = ExceptionType(11);
166+
pub const EXCEPT_RISCV_ENV_CALL_FROM_MMODE: Self = Self(11);
167167
/// Instruction page fault
168-
pub const EXCEPT_RISCV_INST_PAGE_FAULT: ExceptionType = ExceptionType(12);
168+
pub const EXCEPT_RISCV_INST_PAGE_FAULT: Self = Self(12);
169169
/// Load page fault
170-
pub const EXCEPT_RISCV_LOAD_PAGE_FAULT: ExceptionType = ExceptionType(13);
170+
pub const EXCEPT_RISCV_LOAD_PAGE_FAULT: Self = Self(13);
171171
/// Store AMO page fault
172-
pub const EXCEPT_RISCV_STORE_AMO_PAGE_FAULT: ExceptionType = ExceptionType(15);
172+
pub const EXCEPT_RISCV_STORE_AMO_PAGE_FAULT: Self = Self(15);
173173
// RISC-V interrupt types
174174
/// Supervisor software interrupt
175-
pub const EXCEPT_RISCV_SUPERVISOR_SOFTWARE_INT: ExceptionType = ExceptionType(1);
175+
pub const EXCEPT_RISCV_SUPERVISOR_SOFTWARE_INT: Self = Self(1);
176176
/// Machine software interrupt
177-
pub const EXCEPT_RISCV_MACHINE_SOFTWARE_INT: ExceptionType = ExceptionType(3);
177+
pub const EXCEPT_RISCV_MACHINE_SOFTWARE_INT: Self = Self(3);
178178
/// Supervisor timer interrupt
179-
pub const EXCEPT_RISCV_SUPERVISOR_TIMER_INT: ExceptionType = ExceptionType(5);
179+
pub const EXCEPT_RISCV_SUPERVISOR_TIMER_INT: Self = Self(5);
180180
/// Machine timer interrupt
181-
pub const EXCEPT_RISCV_MACHINE_TIMER_INT: ExceptionType = ExceptionType(7);
181+
pub const EXCEPT_RISCV_MACHINE_TIMER_INT: Self = Self(7);
182182
/// Supervisor external interrupt
183-
pub const EXCEPT_RISCV_SUPERVISOR_EXTERNAL_INT: ExceptionType = ExceptionType(9);
183+
pub const EXCEPT_RISCV_SUPERVISOR_EXTERNAL_INT: Self = Self(9);
184184
/// Machine external interrupt
185-
pub const EXCEPT_RISCV_MACHINE_EXTERNAL_INT: ExceptionType = ExceptionType(11);
185+
pub const EXCEPT_RISCV_MACHINE_EXTERNAL_INT: Self = Self(11);
186186
}

0 commit comments

Comments
 (0)