Skip to content

Commit

Permalink
Use os_info instead of os_type
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-tkach authored and spacekookie committed Feb 16, 2021
1 parent 89664fb commit ffe447a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ uuid = { version = "0.8.0", features = ["v4"], default-features = false }
serde_derive = "1.0.79"
toml = "0.5.0"
serde = "1.0.79"
os_type = "2.2.0"
os_info = "2.0.6"
backtrace = "0.3.9"

[features]
Expand Down
10 changes: 2 additions & 8 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use backtrace::Backtrace;
use serde_derive::Serialize;
use std::borrow::Cow;
use std::error::Error;
use std::fmt::Write as FmtWrite;
use std::mem;
Expand All @@ -26,7 +25,7 @@ pub enum Method {
#[derive(Debug, Serialize)]
pub struct Report {
name: String,
operating_system: Cow<'static, str>,
operating_system: String,
crate_version: String,
explanation: String,
cause: String,
Expand All @@ -43,12 +42,7 @@ impl Report {
explanation: String,
cause: String,
) -> Self {
let operating_system = if cfg!(windows) {
"windows".into()
} else {
let platform = os_type::current_platform();
format!("unix:{:?}", platform.os_type).into()
};
let operating_system = os_info::get().to_string();

//We skip 3 frames from backtrace library
//Then we skip 3 frames for our own library
Expand Down

2 comments on commit ffe447a

@Profpatsch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke compatibility with rustc 1.41, because os_info uses the experimental feature #[non_exhaustive].

@Profpatsch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.