Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI
on: [push, pull_request]

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [stable, beta, nightly, macos, win32, win64, mingw]
include:
- build: stable
os: ubuntu-latest
rust: stable
- build: beta
os: ubuntu-latest
rust: beta
- build: nightly
os: ubuntu-latest
rust: nightly
- build: macos
os: macos-latest
rust: stable
- build: win32
os: windows-latest
rust: stable-i686
- build: win64
os: windows-latest
rust: stable-x86_64
- build: mingw
os: windows-latest
rust: stable-x86_64-gnu
steps:
- uses: actions/checkout@master
- name: Install Rust (rustup)
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
if: matrix.os != 'macos-latest'
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y
echo "##[add-path]$HOME/.cargo/bin"
if: matrix.os == 'macos-latest'
- run: cargo test --verbose
- run: cargo test --verbose --features serde
- run: cargo test --verbose --features std
- run: cargo test --verbose --features kv_unstable
- run: cargo test --verbose --features "kv_unstable std"
- run: cargo test --verbose --features "kv_unstable_sval"
- run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml
- run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml --release

rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check

msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update 1.16.0 && rustup default 1.16.0
- run: cargo build --verbose
- run: cargo build --verbose --features serde
- run: cargo build --verbose --features std

embedded:
name: Embedded
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update stable && rustup default stable
- run: rustup target add thumbv6m-none-eabi
- run: cargo build --verbose --target=thumbv6m-none-eabi
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ std = []
kv_unstable = []
kv_unstable_sval = ["kv_unstable", "sval/fmt"]

[badges]
travis-ci = { repository = "rust-lang-nursery/log" }
appveyor = { repository = "alexcrichton/log" }

[dependencies]
cfg-if = "0.1.2"
serde = { version = "1.0", optional = true, default-features = false }
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ log

A Rust library providing a lightweight logging *facade*.

[![Build Status](https://travis-ci.com/rust-lang-nursery/log.svg?branch=master)](https://travis-ci.com/rust-lang-nursery/log)
[![Build status](https://ci.appveyor.com/api/projects/status/nopdjmmjt45xcrki?svg=true)](https://ci.appveyor.com/project/alexcrichton/log)
[![Latest version](https://img.shields.io/crates/v/log.svg)](https://crates.io/crates/log)
[![Documentation](https://docs.rs/log/badge.svg)](https://docs.rs/log)
![License](https://img.shields.io/crates/l/log.svg)
Expand Down
19 changes: 0 additions & 19 deletions appveyor.yml

This file was deleted.

8 changes: 3 additions & 5 deletions src/kv/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt;
/// An error encountered while working with structured data.
#[derive(Debug)]
pub struct Error {
inner: Inner
inner: Inner,
}

#[derive(Debug)]
Expand Down Expand Up @@ -37,9 +37,7 @@ impl fmt::Display for Error {

impl From<fmt::Error> for Error {
fn from(_: fmt::Error) -> Self {
Error {
inner: Inner::Fmt,
}
Error { inner: Inner::Fmt }
}
}

Expand All @@ -63,7 +61,7 @@ mod std_support {
E: Into<BoxedError>,
{
Error {
inner: Inner::Boxed(err.into())
inner: Inner::Boxed(err.into()),
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/kv/key.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Structured keys.

use std::fmt;
use std::borrow::Borrow;
use std::cmp;
use std::fmt;
use std::hash;
use std::borrow::Borrow;

/// A type that can be converted into a [`Key`](struct.Key.html).
pub trait ToKey {
Expand All @@ -22,9 +22,7 @@ where

impl<'k> ToKey for Key<'k> {
fn to_key(&self) -> Key {
Key {
key: self.key,
}
Key { key: self.key }
}
}

Expand All @@ -43,9 +41,7 @@ pub struct Key<'k> {
impl<'k> Key<'k> {
/// Get a key from a borrowed string.
pub fn from_str(key: &'k str) -> Self {
Key {
key: key,
}
Key { key: key }
}

/// Get a borrowed string from this key.
Expand Down
9 changes: 3 additions & 6 deletions src/kv/source.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Sources for key-value pairs.

use kv::{Error, Key, ToKey, ToValue, Value};
use std::fmt;
use kv::{Error, Key, ToKey, Value, ToValue};

/// A source of key-value pairs.
///
Expand All @@ -22,7 +22,7 @@ pub trait Source {
fn visit<'kvs>(&'kvs self, visitor: &mut Visitor<'kvs>) -> Result<(), Error>;

/// Get the value for a given key.
///
///
/// If the key appears multiple times in the source then which key is returned
/// is implementation specific.
///
Expand All @@ -46,10 +46,7 @@ pub trait Source {
}
}

let mut get = Get {
key,
found: None,
};
let mut get = Get { key, found: None };

let _ = self.visit(&mut get);
get.found
Expand Down
22 changes: 17 additions & 5 deletions src/kv/value/impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;

use super::{ToValue, Value, Primitive};
use super::{Primitive, ToValue, Value};

impl ToValue for usize {
fn to_value(&self) -> Value {
Expand Down Expand Up @@ -246,8 +246,14 @@ mod tests {
assert_eq!(42.01f64.to_value().to_string(), "42.01");
assert_eq!(true.to_value().to_string(), "true");
assert_eq!('a'.to_value().to_string(), "'a'");
assert_eq!(format_args!("a {}", "value").to_value().to_string(), "a value");
assert_eq!("a loong string".to_value().to_string(), "\"a loong string\"");
assert_eq!(
format_args!("a {}", "value").to_value().to_string(),
"a value"
);
assert_eq!(
"a loong string".to_value().to_string(),
"\"a loong string\""
);
assert_eq!(Some(true).to_value().to_string(), "true");
assert_eq!(().to_value().to_string(), "None");
assert_eq!(Option::None::<bool>.to_value().to_string(), "None");
Expand All @@ -260,8 +266,14 @@ mod tests {
assert_eq!(42.01f64.to_value().to_token(), Token::F64(42.01));
assert_eq!(true.to_value().to_token(), Token::Bool(true));
assert_eq!('a'.to_value().to_token(), Token::Char('a'));
assert_eq!(format_args!("a {}", "value").to_value().to_token(), Token::Str("a value".into()));
assert_eq!("a loong string".to_value().to_token(), Token::Str("a loong string".into()));
assert_eq!(
format_args!("a {}", "value").to_value().to_token(),
Token::Str("a value".into())
);
assert_eq!(
"a loong string".to_value().to_token(),
Token::Str("a loong string".into())
);
assert_eq!(Some(true).to_value().to_token(), Token::Bool(true));
assert_eq!(().to_value().to_token(), Token::None);
assert_eq!(Option::None::<bool>.to_value().to_token(), Token::None);
Expand Down
12 changes: 7 additions & 5 deletions src/kv/value/internal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;

use super::{Fill, Slot, Error};
use super::{Error, Fill, Slot};
use kv;

// `Visitor` is an internal API for visiting the structure of a value.
Expand Down Expand Up @@ -49,7 +49,7 @@ impl<'v> Inner<'v> {
pub(super) trait Visitor {
fn debug(&mut self, v: &fmt::Debug) -> Result<(), Error>;
fn display(&mut self, v: &fmt::Display) -> Result<(), Error> {
self.debug(&format_args!("{}", v))
self.debug(&format_args!("{}", v))
}

fn u64(&mut self, v: u64) -> Result<(), Error>;
Expand Down Expand Up @@ -115,7 +115,7 @@ mod fmt_support {
Ok(())
}
}

struct FmtVisitor<'a, 'b: 'a>(&'a mut fmt::Formatter<'b>);

impl<'a, 'b: 'a> Visitor for FmtVisitor<'a, 'b> {
Expand Down Expand Up @@ -197,7 +197,7 @@ pub(super) mod sval_support {
fn from_sval(_: sval::value::Error) -> Self {
Error::msg("`sval` serialization failed")
}

fn into_sval(self) -> sval::value::Error {
sval::value::Error::msg("`sval` serialization failed")
}
Expand All @@ -207,7 +207,9 @@ pub(super) mod sval_support {

impl<'a, 'b: 'a> Visitor for SvalVisitor<'a, 'b> {
fn debug(&mut self, v: &fmt::Debug) -> Result<(), Error> {
self.0.fmt(format_args!("{:?}", v)).map_err(Error::from_sval)
self.0
.fmt(format_args!("{:?}", v))
.map_err(Error::from_sval)
}

fn u64(&mut self, v: u64) -> Result<(), Error> {
Expand Down
16 changes: 7 additions & 9 deletions src/kv/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

use std::fmt;

mod internal;
mod impls;
mod internal;

#[cfg(test)]
pub(in kv) mod test;

pub use kv::Error;

use self::internal::{Inner, Visitor, Primitive};
use self::internal::{Inner, Primitive, Visitor};

/// A type that can be converted into a [`Value`](struct.Value.html).
pub trait ToValue {
Expand All @@ -29,14 +29,12 @@ where

impl<'v> ToValue for Value<'v> {
fn to_value(&self) -> Value {
Value {
inner: self.inner,
}
Value { inner: self.inner }
}
}

/// A type that requires extra work to convert into a [`Value`](struct.Value.html).
///
///
/// This trait is a more advanced initialization API than [`ToValue`](trait.ToValue.html).
/// It's intended for erased values coming from other logging frameworks that may need
/// to perform extra work to determine the concrete type to use.
Expand Down Expand Up @@ -75,11 +73,11 @@ impl<'a> Slot<'a> {
}

/// Fill the slot with a value.
///
///
/// The given value doesn't need to satisfy any particular lifetime constraints.
///
///
/// # Panics
///
///
/// Calling `fill` more than once will panic.
pub fn fill(&mut self, value: Value) -> Result<(), Error> {
assert!(!self.filled, "the slot has already been filled");
Expand Down
2 changes: 1 addition & 1 deletion src/kv/value/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use std::fmt;
use std::str;

use super::{Value, Error};
use super::internal;
use super::{Error, Value};

#[derive(Debug, PartialEq)]
pub(in kv) enum Token {
Expand Down
Loading