mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 10:17:58 +08:00
refactor: Directly swap variable values (#1970)
Signed-off-by: cuishuang <imcusg@gmail.com>
This commit is contained in:
parent
875aba849e
commit
5936bd1a83
@ -193,9 +193,7 @@ func bubSort(d []api_model.MessageData) []api_model.MessageData {
|
||||
for i := 0; i < len(d); i++ {
|
||||
for j := i + 1; j < len(d); j++ {
|
||||
if d[i].Unixtime > d[j].Unixtime {
|
||||
temp := d[i]
|
||||
d[i] = d[j]
|
||||
d[j] = temp
|
||||
d[i], d[j] = d[j], d[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,9 +62,7 @@ func (list TenantResList) Less(i, j int) bool {
|
||||
}
|
||||
|
||||
func (list TenantResList) Swap(i, j int) {
|
||||
temp := list[i]
|
||||
list[i] = list[j]
|
||||
list[j] = temp
|
||||
list[i], list[j] = list[j], list[i]
|
||||
}
|
||||
|
||||
//TenantAndResource tenant and resource strcut
|
||||
|
@ -367,9 +367,7 @@ func (m *MonitorMessageList) Less(i, j int) bool {
|
||||
|
||||
// Swap 交换索引为 i 和 j 的元素
|
||||
func (m *MonitorMessageList) Swap(i, j int) {
|
||||
tmp := (*m)[i]
|
||||
(*m)[i] = (*m)[j]
|
||||
(*m)[j] = tmp
|
||||
(*m)[i], (*m)[j] = (*m)[j], (*m)[i]
|
||||
}
|
||||
|
||||
//Pop Pop
|
||||
|
Loading…
Reference in New Issue
Block a user