Skip to content

Commit 6f1cfc6

Browse files
committed
log: don't use self::QtMsgType::*;
1 parent 20f4814 commit 6f1cfc6

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

qmetaobject/src/log.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use log::{Level, logger, Record};
66

77
use crate::QString;
88

9-
use self::QtMsgType::*;
10-
119
cpp! {{
1210
#include <qmetaobject_rust.hpp>
1311
}}
@@ -88,11 +86,11 @@ impl From<QtMsgType> for Level {
8886
/// [`Qt::QtMsgType`]: https://doc.qt.io/qt-5/qtglobal.html#QtMsgType-enum
8987
fn from(lvl: QtMsgType) -> Self {
9088
match lvl {
91-
QtDebugMsg => Level::Debug,
92-
QtInfoMsg => Level::Info,
93-
QtWarningMsg => Level::Warn,
94-
QtCriticalMsg => Level::Error,
95-
QtFatalMsg => Level::Error,
89+
QtMsgType::QtDebugMsg => Level::Debug,
90+
QtMsgType::QtInfoMsg => Level::Info,
91+
QtMsgType::QtWarningMsg => Level::Warn,
92+
QtMsgType::QtCriticalMsg => Level::Error,
93+
QtMsgType::QtFatalMsg => Level::Error,
9694
// XXX: What are the external guarantees about possible values of QtMsgType?
9795
// XXX: Are they promised to be limited to the valid enum variants?
9896
}
@@ -113,11 +111,11 @@ impl From<Level> for QtMsgType {
113111
/// [`Qt::QtMsgType`]: https://doc.qt.io/qt-5/qtglobal.html#QtMsgType-enum
114112
fn from(lvl: Level) -> Self {
115113
match lvl {
116-
Level::Error => QtCriticalMsg,
117-
Level::Warn => QtWarningMsg,
118-
Level::Info => QtInfoMsg,
119-
Level::Debug => QtDebugMsg,
120-
Level::Trace => QtDebugMsg,
114+
Level::Error => QtMsgType::QtCriticalMsg,
115+
Level::Warn => QtMsgType::QtWarningMsg,
116+
Level::Info => QtMsgType::QtInfoMsg,
117+
Level::Debug => QtMsgType::QtDebugMsg,
118+
Level::Trace => QtMsgType::QtDebugMsg,
121119
}
122120
}
123121
}
@@ -201,7 +199,7 @@ mod tests {
201199

202200
#[test]
203201
fn test_convert() {
204-
assert_eq!(Level::from(QtInfoMsg), Level::Info);
205-
assert_eq!(QtCriticalMsg, QtMsgType::from(Level::Error))
202+
assert_eq!(Level::from(QtMsgType::QtInfoMsg), Level::Info);
203+
assert_eq!(QtMsgType::QtCriticalMsg, QtMsgType::from(Level::Error))
206204
}
207205
}

0 commit comments

Comments
 (0)